Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

What is the difference between GetShare() and GetReceivedShare() #50

Closed
Triantafullenia-Doumani opened this issue Oct 6, 2021 · 4 comments

Comments

@Triantafullenia-Doumani
Copy link

By the Interface that manipulates shares on Reva side we know:

  • GetShare() : gets the information for a share by the given ref

  • GetReceivedShare() : returns the information for a received share the user has access.

So, as I understand the only difference is:

  • GetShare() will return a share( no matter who created it)
  • GetReceivedShare() will return a share someone else created( because it is a received share).

In every case, the user needs to have access to the share, and we get the share by the unique id.

If (this is the only difference):

  • Why do we need 2 methods for that?

else :

  • What are the differences?
@Triantafullenia-Doumani Triantafullenia-Doumani added this to the Share milestone Oct 6, 2021
@Triantafullenia-Doumani
Copy link
Author

Triantafullenia-Doumani commented Oct 6, 2021

By replying to this, we will also make clear what is the difference between

  • ListReceivedShares() and ListShares()
  • UpdateReceivedShare() and UpdateShare()

@michielbdejong
Copy link
Member

See also cs3org/reva#2148 and cs3org/cs3apis#150

@Triantafullenia-Doumani
Copy link
Author

We have updated our code, and now we are using the shareManager from OCP\Share\IManager;.
( We were using the shareAPIController from OCA\Files_Sharing\Controller\)

So, with the shareManager we are calling these methods:

* getSharedWith($userId, $shareType, $node = null, $limit = 50, $offset = 0)
* getShareById($id, $recipient = null)
* getSharesBy($userId, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0)

When we want all the shares the user has access(not created by him), we use the:
getSharedWith($userId, IShare::TYPE_REMOTE)

Related methods:

  • ListReceivedShares

When we want a share, the user received, we use the:
getShareById($opaqueId,$userId)

Related methods:

  • GetReceivedShare()
  • UpdateReceivedShare()

So, now it makes sense to have different methods to handle the shares the user received and the shares he shared

@michielbdejong What do you think?

@michielbdejong
Copy link
Member

We've been working on pkg/share but we should have been working on pkg/ocm/share :(

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

No branches or pull requests

2 participants