summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-02-02 16:55:41 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-02-03 19:25:29 +0100
commit78be766cf543d738a3822a3cd614634acb7262d0 (patch)
treea1735fc055249aa046e65a6522a067dafcaa053b /lib
parentc0322b3f983635ee3653a13837ae29e152e78803 (diff)
downloadnextcloud-server-78be766cf543d738a3822a3cd614634acb7262d0.tar.gz
nextcloud-server-78be766cf543d738a3822a3cd614634acb7262d0.zip
[Share 2.0] Use strings for ids
* sharedWith * sharedBy * shareOwner Now all set/get strings with the id. (userId, groupId, federatedsharerId). This to avoid a huge amount of if statements
Diffstat (limited to 'lib')
-rw-r--r--lib/private/share20/share.php9
-rw-r--r--lib/public/share/ishare.php12
-rw-r--r--lib/public/share/ishareprovider.php22
3 files changed, 26 insertions, 17 deletions
diff --git a/lib/private/share20/share.php b/lib/private/share20/share.php
index f9cba10a07a..db91ad4a91d 100644
--- a/lib/private/share20/share.php
+++ b/lib/private/share20/share.php
@@ -121,6 +121,9 @@ class Share implements \OCP\Share\IShare {
* @inheritdoc
*/
public function setSharedWith($sharedWith) {
+ if (!is_string($sharedWith)) {
+ throw new \InvalidArgumentException();
+ }
$this->sharedWith = $sharedWith;
return $this;
}
@@ -170,6 +173,9 @@ class Share implements \OCP\Share\IShare {
* @inheritdoc
*/
public function setSharedBy($sharedBy) {
+ if (!is_string($sharedBy)) {
+ throw new \InvalidArgumentException();
+ }
//TODO checks
$this->sharedBy = $sharedBy;
@@ -188,6 +194,9 @@ class Share implements \OCP\Share\IShare {
* @inheritdoc
*/
public function setShareOwner($shareOwner) {
+ if (!is_string($shareOwner)) {
+ throw new \InvalidArgumentException();
+ }
//TODO checks
$this->shareOwner = $shareOwner;
diff --git a/lib/public/share/ishare.php b/lib/public/share/ishare.php
index 80e7f7f56ef..5a82436c720 100644
--- a/lib/public/share/ishare.php
+++ b/lib/public/share/ishare.php
@@ -89,7 +89,7 @@ interface IShare {
/**
* Set the receiver of this share.
*
- * @param IUser|IGroup
+ * @param string $sharedWith
* @return \OCP\Share\IShare The modified object
* @since 9.0.0
*/
@@ -98,7 +98,7 @@ interface IShare {
/**
* Get the receiver of this share.
*
- * @return IUser|IGroup
+ * @return string
* @since 9.0.0
*/
public function getSharedWith();
@@ -142,7 +142,7 @@ interface IShare {
/**
* Set the sharer of the path.
*
- * @param IUser $sharedBy
+ * @param string $sharedBy
* @return \OCP\Share\IShare The modified object
* @since 9.0.0
*/
@@ -151,7 +151,7 @@ interface IShare {
/**
* Get share sharer
*
- * @return IUser
+ * @return string
* @since 9.0.0
*/
public function getSharedBy();
@@ -159,7 +159,7 @@ interface IShare {
/**
* Set the original share owner (who owns the path that is shared)
*
- * @param IUser
+ * @param string $shareOwner
* @return \OCP\Share\IShare The modified object
* @since 9.0.0
*/
@@ -168,7 +168,7 @@ interface IShare {
/**
* Get the original share owner (who owns the path that is shared)
*
- * @return IUser
+ * @return string
* @since 9.0.0
*/
public function getShareOwner();
diff --git a/lib/public/share/ishareprovider.php b/lib/public/share/ishareprovider.php
index 42a2881718e..a14d58734bc 100644
--- a/lib/public/share/ishareprovider.php
+++ b/lib/public/share/ishareprovider.php
@@ -74,10 +74,10 @@ interface IShareProvider {
* share from their self then the original group share should still exist.
*
* @param \OCP\Share\IShare $share
- * @param IUser $recipient
+ * @param string $recipient UserId of the recipient
* @since 9.0.0
*/
- public function deleteFromSelf(\OCP\Share\IShare $share, IUser $recipient);
+ public function deleteFromSelf(\OCP\Share\IShare $share, $recipient);
/**
* Move a share as a recipient.
@@ -86,36 +86,36 @@ interface IShareProvider {
* the target should only be changed for them.
*
* @param \OCP\Share\IShare $share
- * @param IUser $recipient
+ * @param string $recipient userId of recipient
* @return \OCP\Share\IShare
* @since 9.0.0
*/
- public function move(\OCP\Share\IShare $share, IUser $recipient);
+ public function move(\OCP\Share\IShare $share, $recipient);
/**
* Get all shares by the given user
*
- * @param IUser $user
+ * @param string $userId
* @param int $shareType
* @param \OCP\Files\File|\OCP\Files\Folder $node
* @param bool $reshares Also get the shares where $user is the owner instead of just the shares where $user is the initiator
* @param int $limit The maximum number of shares to be returned, -1 for all shares
* @param int $offset
- * @return \OCP\Share\I Share[]
+ * @return \OCP\Share\IShare Share[]
* @since 9.0.0
*/
- public function getSharesBy(IUser $user, $shareType, $node, $reshares, $limit, $offset);
+ public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset);
/**
* Get share by id
*
* @param int $id
- * @param IUser|null $recipient
+ * @param string|null $recipientId
* @return \OCP\Share\IShare
* @throws ShareNotFound
* @since 9.0.0
*/
- public function getShareById($id, $recipient = null);
+ public function getShareById($id, $recipientId = null);
/**
* Get shares for a given path
@@ -129,7 +129,7 @@ interface IShareProvider {
/**
* Get shared with the given user
*
- * @param IUser $user get shares where this user is the recipient
+ * @param stromg $userId get shares where this user is the recipient
* @param int $shareType
* @param Node|null $node
* @param int $limit The max number of entries returned, -1 for all
@@ -137,7 +137,7 @@ interface IShareProvider {
* @return \OCP\Share\IShare[]
* @since 9.0.0
*/
- public function getSharedWith(IUser $user, $shareType, $node, $limit, $offset);
+ public function getSharedWith($userId, $shareType, $node, $limit, $offset);
/**
* Get a share by token