Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access list to share manager #2834

Merged
merged 29 commits into from
Apr 15, 2017
Merged

Access list to share manager #2834

merged 29 commits into from
Apr 15, 2017

Conversation

rullzer
Copy link
Member

@rullzer rullzer commented Dec 22, 2016

Revived this PR to get rid of the old code

What we do now is offload the accesslist creation to the share providers. Which allows for way more efficient queries.

The manager function now can handle recursion and directly filter out users the currently have no access to the Node (delete group shares for example).

The helper class should be able to assist for notifications.

@nickvergessen @schiessle lets see if we can get this moving!

TODO:

@mention-bot
Copy link

@rullzer, thanks for your PR! By analyzing the history of the files in this pull request, we identified @schiessle, @LukasReschke and @icewind1991 to be potential reviewers.

@rullzer rullzer added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Dec 23, 2016
@rullzer rullzer force-pushed the accesListToShareManager branch 2 times, most recently from fa99f97 to 2309e25 Compare December 23, 2016 07:44
@@ -767,4 +767,8 @@ public function getSharesInFolder($userId, Folder $node, $reshares) {
return $shares;
}

public function getAccessList($nodes, $currentAccess) {
return ['users' => [], 'remote' => false, 'public' => false];
Copy link
Member

@schiessle schiessle Dec 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we check here if the file or a file in the folder is shared by mail and set 'public' to true (this would be enough for encryption)? To make it more generic we could also add another key 'mail' to the array, which would probably be the better solution.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah didn't think about it yet. Just had to implement something that did not break. I'm fine with both so whatever you prefer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok added

@LukasReschke LukasReschke changed the title Acces list to share manager Access list to share manager Dec 27, 2016
@rullzer rullzer force-pushed the accesListToShareManager branch 2 times, most recently from a5051d9 to 76a0ddb Compare January 4, 2017 08:33
@codecov-io
Copy link

codecov-io commented Jan 4, 2017

Codecov Report

Merging #2834 into master will increase coverage by 0.36%.
The diff coverage is 90.3%.

@@             Coverage Diff              @@
##             master    #2834      +/-   ##
============================================
+ Coverage     54.08%   54.44%   +0.36%     
- Complexity    21428    21690     +262     
============================================
  Files          1317     1324       +7     
  Lines         81663    82896    +1233     
  Branches       1305     1305              
============================================
+ Hits          44167    45134     +967     
- Misses        37496    37762     +266
Impacted Files Coverage Δ Complexity Δ
...e/AppFramework/DependencyInjection/DIContainer.php 82.75% <ø> (-0.69%) 42 <0> (+17)
apps/sharebymail/tests/ShareByMailProviderTest.php 99.76% <100%> (+0.02%) 25 <1> (+1) ⬆️
lib/private/Server.php 92.73% <100%> (-0.33%) 188 <1> (+68)
...ederatedfilesharing/lib/FederatedShareProvider.php 66.25% <100%> (+2.1%) 80 <4> (+4) ⬆️
lib/private/Encryption/File.php 83.33% <100%> (+4.76%) 12 <1> (+2) ⬆️
lib/private/Share20/ShareHelper.php 74.35% <74.35%> (ø) 28 <28> (?)
lib/private/Share20/DefaultShareProvider.php 91.5% <90.66%> (-0.16%) 114 <22> (+21)
apps/sharebymail/lib/ShareByMailProvider.php 62.46% <94.44%> (+1.51%) 64 <2> (+2) ⬆️
lib/private/Share20/Manager.php 94.35% <96.96%> (+0.33%) 221 <12> (+11) ⬆️
lib/public/Share.php 59.64% <0%> (-7.02%) 26% <0%> (ø)
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 51377f3...cab4111. Read the comment docs.

@rullzer rullzer added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jan 4, 2017
@rullzer
Copy link
Member Author

rullzer commented Jan 10, 2017

@nickvergessen @schiessle please have a look

$public = $resultForFile['public'] || $resultForFile['remote'] || $public;
if ($file !== null) {
$resultForFile = $this->shareManager->getAccessList($file, false);
$userIds = \array_merge($userIds, $resultForFile['users']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove leading slash?

* @return array
* @since 9.2.0
*/
public function getAccessList(\OCP\Files\Node $path, $recursive = true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing , $currentAccess = false ?

* @param array $users Array of userIds
* @return array Mapping $uid to an array of nodes
*/
public function getPathsForAccessList(Node $node, $users) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No public API?

@MorrisJobke MorrisJobke added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jan 26, 2017
Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rullzer See comments by @nickvergessen

nickvergessen and others added 4 commits April 13, 2017 12:58
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@rullzer rullzer added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Apr 13, 2017
@rullzer
Copy link
Member Author

rullzer commented Apr 13, 2017

👍 for me now. Seems to do all the tricks!

@schiessle can you have a look as well?

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@schiessle
Copy link
Member

'public' need to be true as soon as one remote-share, email-share or public link exists. I don't see that this is the case here, but maybe I missed something.

@rullzer
Copy link
Member Author

rullzer commented Apr 13, 2017

don't we ave remote for remote?

@rullzer
Copy link
Member Author

rullzer commented Apr 13, 2017

@schiessle also see #2834 (comment) ;)

@schiessle
Copy link
Member

Yes you are right, remote shares are separate, only the encryption code merges them: https://github.com/nextcloud/server/blob/master/lib/private/Encryption/File.php#L79

But mail-shares and public links where handled by the share api as the same: https://github.com/nextcloud/server/blob/master/lib/private/Share/Share.php#L269

So we either need to keep this behaviour for mail shares and public links or extend the logic on the encryption code to merge public, remote and mail.

@rullzer
Copy link
Member Author

rullzer commented Apr 13, 2017

Let me just replace the public key. Because the code doesn't care so that seems the easy way.

@schiessle
Copy link
Member

also see #2834 (comment) ;)

Yes, makes probably sense to show mail shares as mail shares but then we need to update it here https://github.com/nextcloud/server/blob/master/lib/private/Encryption/File.php#L79 and here https://github.com/nextcloud/server/blob/master/lib/private/Encryption/File.php#L85

@rullzer
Copy link
Member Author

rullzer commented Apr 13, 2017

@schiessle I just made it public now. As that keep the behavior as is for now.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@rullzer
Copy link
Member Author

rullzer commented Apr 13, 2017

CI is happy (well 1 timed out).
Also activities and encryption seem to work properly for me still!

@schiessle @nickvergessen what do you say? Lets get this in!

@nickvergessen
Copy link
Member

👍

@MorrisJobke MorrisJobke merged commit 10290eb into master Apr 15, 2017
@MorrisJobke MorrisJobke deleted the accesListToShareManager branch April 15, 2017 18:06
@ArtificialOwl
Copy link
Member

Circles complies with the new ShareProvider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants