Skip to content

[Share 2.0] get shares - #21532

Merged
DeepDiver1975 merged 8 commits into
masterfrom
share2.0_getShares
Jan 22, 2016
Merged

DeepDiver1975 merged 8 commits into
masterfrom
share2.0_getShares

Conversation

@rullzer

@rullzer rullzer commented Jan 8, 2016

Copy link
Copy Markdown
Contributor

Now that create shares is in. Rebasing and refactoring of the other code paths can continue.

@rullzer rullzer added this to the 9.0-current milestone Jan 8, 2016
@mention-bot

Copy link
Copy Markdown

By analyzing the blame information on this pull request, we identified @SergioBertolinSG to be a potential reviewer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

where did offset and limit go?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed them for now since I still need to think how to do that properly with multiple providers... I need to think of a way that will properly scale..

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since the sharetype was passed in the call can be redirected to exactly one provider - right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

well we don't know the shareType for a lot of calls.. For example the OCS Share API usually is called without arguments. Or maybe a path.

But I have no idea how to do limit and offset with multiple providers effeciently.

So should we just add the shareType as a required parameter. Will result is more queries. But makes pagination possible. Note that these are (for the default provider at least) straight forward queries. That just do selection. So they are less of an issue than update/delete stuff...

@rullzer
rullzer force-pushed the share2.0_getShares branch from 97f895b to be3e35d Compare January 14, 2016 06:46
@rullzer

rullzer commented Jan 14, 2016

Copy link
Copy Markdown
Contributor Author

Ok feedback needed. What do we expect the getShares function to return (I know shares). But I came across a slightly more tricky situation.

  • Assume user1 shares a folder with the group foo.
  • user2 (in the group foo) deletes this share.
    • This adds an extra entry to the share table of type 2 (special type)
    • This entry had permissions set to 0
    • This entry has parent set to the original share

Thus basically we have the following:

id type with by permissions parent
1 1 foo user1 31
2 2 user2 user1 0 1

No if I query getShares for user1 (so get all the shares by) It should only return the share with id 1. The other stuff is internal and has no place on the outside!

But now what if we want to call the function getSharedWith with user2?

I would think we want to return the 'original' share. But the permissions set to 0 right? That way the share manager is nicely kept in the dark about share type 2 (which is good).

But then we need to think about the delete function a bit. Because if the receiving user deletes a share other stuff should happen than if the owner or initiator deletes a group share.

Input and comments are appriciated: @schiesbn @DeepDiver1975 @nickvergessen @PVince81

@schiessle

Copy link
Copy Markdown
Contributor

I would think we want to return the 'original' share. But the permissions set to 0 right? That way the share manager is nicely kept in the dark about share type 2 (which is good).

yes, I think that's the right behavior.

But then we need to think about the delete function a bit. Because if the receiving user deletes a share other stuff should happen than if the owner or initiator deletes a group share.

What differences do you see here. I think this are just two seperate operation "unshare" and "unshare-from-self". Which can work the same way for sharing 2.0 as it works now.

Some more general thoughts: In the long run I would like to have a side-bar entry "open shares" which contain unaccepted federated share. I would also move group/user shares there if the user unshares them from self, so that he can bring them back if he wish.

@rullzer

rullzer commented Jan 14, 2016

Copy link
Copy Markdown
Contributor Author

What differences do you see here. I think this are just two seperate operation "unshare" and "unshare-from-self". Which can work the same way for sharing 2.0 as it works now.

Exactly we then need a delete-from-self function. Which is fine. But needs to be added then.

Some more general thoughts: In the long run I would like to have a side-bar entry "open shares" which contain unaccepted federated share. I would also move group/user shares there if the user unshares them from self, so that he can bring them back if he wish.

Yes we can easily query for this. And we should have it indeed.

@rullzer

rullzer commented Jan 18, 2016

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 I'll add the pagination back. But in the OCS SHare API currently there is no pagination so we just fetch everything.

I also added a $shareType parameter to the calls since that is the only way I can get proper pagination. In other words the OCS Share API v2 can figure out itself how to handle that all properly.

@rullzer
rullzer force-pushed the share2.0_getShares branch from be3e35d to 61951f1 Compare January 19, 2016 13:39
@rullzer rullzer changed the title [WIP][Share 2.0] get shares [Share 2.0] get shares Jan 19, 2016
Comment thread apps/files_sharing/api/share20ocs.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no change of behavior I guess?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah this is currently not in there so no need to add it now indeed.

@PVince81

Copy link
Copy Markdown
Contributor

Apart from #21532 (comment) and a few clarifications, the code looks good.

I haven't tested it. Are there unit tests ? Are these changes covered by the API tests ?

@rullzer

rullzer commented Jan 20, 2016

Copy link
Copy Markdown
Contributor Author

@PVince81 ah right I have the tests stashed somewhere... lets add them :P

@rullzer

rullzer commented Jan 20, 2016

Copy link
Copy Markdown
Contributor Author

@PVince81 unit tests added (I had some but extended a bit). This is also tested via the intergration tests.

@nickvergessen could you smash?

@PVince81

Copy link
Copy Markdown
Contributor

👍

@PVince81

Copy link
Copy Markdown
Contributor

Smashing now...

@PVince81

Copy link
Copy Markdown
Contributor

Smashbox worked.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

$node could be typehinted to OCP\Files\Node ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In theory yes. But I actually want it to be either a File or a Folder. Typehinting it to node might give the wrong idea...

@nickvergessen

Copy link
Copy Markdown
Contributor

This PR breaks the share filters of the file list for me:
Shared by link: index.php/apps/files/?dir=%2F&view=sharinglinks
Shared with others: index.php/apps/files/?dir=%2F&view=sharingout

Only:
Shared with you: index.php/apps/files/?dir=%2F&view=sharingin
still works

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this can also be 'false' 🙊 in case of outgoing shares

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

well setting it to false should to not do anything....

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@rullzer rebase please

@rullzer
rullzer force-pushed the share2.0_getShares branch from 3bf51a5 to 6589595 Compare January 21, 2016 15:08
@rullzer

rullzer commented Jan 21, 2016

Copy link
Copy Markdown
Contributor Author

rebased.
And added work around for the webUI showing of sharingout.

@DeepDiver1975

Copy link
Copy Markdown
Contributor

👍

DeepDiver1975 added a commit that referenced this pull request Jan 22, 2016
@DeepDiver1975
DeepDiver1975 merged commit 766ba1c into master Jan 22, 2016
@nickvergessen
nickvergessen deleted the share2.0_getShares branch January 22, 2016 07:43
@rullzer rullzer mentioned this pull request Jan 25, 2016
35 of 43 tasks
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants