summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-01-27 12:13:53 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-01-27 22:04:37 +0100
commit185b9c6edd56157f45c72800fdea104bd360925a (patch)
treed47fc798513a5d1e680451d24f81e43c1a5bc28e /lib/public
parent0832cca54e09c9b1f04f3133cc1780ca6ab1ae3b (diff)
downloadnextcloud-server-185b9c6edd56157f45c72800fdea104bd360925a.tar.gz
nextcloud-server-185b9c6edd56157f45c72800fdea104bd360925a.zip
[Share 2.0] Move IShare to OCP
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/share/iproviderfactory.php57
-rw-r--r--lib/public/share/ishare.php283
-rw-r--r--lib/public/share/ishareprovider.php134
3 files changed, 474 insertions, 0 deletions
diff --git a/lib/public/share/iproviderfactory.php b/lib/public/share/iproviderfactory.php
new file mode 100644
index 00000000000..3a8baccf33b
--- /dev/null
+++ b/lib/public/share/iproviderfactory.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * @author Roeland Jago Douma <rullzer@owncloud.com>
+ *
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCP\Share;
+
+use OC\Share20\Exception\ProviderException;
+use OCP\IServerContainer;
+
+/**
+ * Interface IProviderFactory
+ *
+ * @package OC\Share20
+ * @since 9.0.0
+ */
+interface IProviderFactory {
+
+ /**
+ * IProviderFactory constructor.
+ * @param IServerContainer $serverContainer
+ * @since 9.0.0
+ */
+ public function __construct(IServerContainer $serverContainer);
+
+ /**
+ * @param string $id
+ * @return IShareProvider
+ * @throws ProviderException
+ * @since 9.0.0
+ */
+ public function getProvider($id);
+
+ /**
+ * @param int $shareType
+ * @return IShareProvider
+ * @throws ProviderException
+ * @since 9.0.0
+ */
+ public function getProviderForType($shareType);
+}
diff --git a/lib/public/share/ishare.php b/lib/public/share/ishare.php
new file mode 100644
index 00000000000..1038ccf4389
--- /dev/null
+++ b/lib/public/share/ishare.php
@@ -0,0 +1,283 @@
+<?php
+/**
+ * @author Roeland Jago Douma <rullzer@owncloud.com>
+ *
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCP\Share;
+
+use OCP\Files\File;
+use OCP\Files\Folder;
+use OCP\Files\Node;
+use OCP\IUser;
+use OCP\IGroup;
+
+/**
+ * Interface IShare
+ *
+ * @package OCP\Share
+ * @since 9.0.0
+ */
+interface IShare {
+
+ /**
+ * Get the id of the share
+ *
+ * @return string
+ * @since 9.0.0
+ */
+ public function getId();
+
+ /**
+ * Set the id of the share
+ *
+ * @param string $id
+ * @return \OCP\Share\IShare The modified share object
+ * @since 9.0.0
+ */
+ public function setId($id);
+
+ /**
+ * Get the full share id
+ *
+ * @return string
+ * @since 9.0.0
+ */
+ public function getFullId();
+
+ /**
+ * Set the provider id
+ *
+ * @param string $id
+ * @return \OCP\Share\IShare The modified share object\
+ * @since 9.0.0
+ */
+ public function setProviderId($id);
+
+ /**
+ * Set the path of this share
+ *
+ * @param Node $path
+ * @return \OCP\Share\IShare The modified object
+ * @since 9.0.0
+ */
+ public function setPath(Node $path);
+
+ /**
+ * Get the path of this share for the current user
+ *
+ * @return File|Folder
+ * @since 9.0.0
+ */
+ public function getPath();
+
+ /**
+ * Set the shareType
+ *
+ * @param int $shareType
+ * @return \OCP\Share\IShare The modified object
+ * @since 9.0.0
+ */
+ public function setShareType($shareType);
+
+ /**
+ * Get the shareType
+ *
+ * @return int
+ * @since 9.0.0
+ */
+ public function getShareType();
+
+ /**
+ * Set the receiver of this share
+ *
+ * @param IUser|IGroup|string
+ * @return \OCP\Share\IShare The modified object
+ * @since 9.0.0
+ */
+ public function setSharedWith($sharedWith);
+
+ /**
+ * Get the receiver of this share
+ *
+ * @return IUser|IGroup|string
+ * @since 9.0.0
+ */
+ public function getSharedWith();
+
+ /**
+ * Set the permissions
+ *
+ * @param int $permissions
+ * @return \OCP\Share\IShare The modified object
+ * @since 9.0.0
+ */
+ public function setPermissions($permissions);
+
+ /**
+ * Get the share permissions
+ *
+ * @return int
+ * @since 9.0.0
+ */
+ public function getPermissions();
+
+ /**
+ * Set the expiration date
+ *
+ * @param \DateTime $expireDate
+ * @return \OCP\Share\IShare The modified object
+ * @since 9.0.0
+ */
+ public function setExpirationDate($expireDate);
+
+ /**
+ * Get the share expiration date
+ *
+ * @return \DateTime
+ * @since 9.0.0
+ */
+ public function getExpirationDate();
+
+ /**
+ * Set the sharer of the path
+ *
+ * @param IUser|string $sharedBy
+ * @return \OCP\Share\IShare The modified object
+ * @since 9.0.0
+ */
+ public function setSharedBy($sharedBy);
+
+ /**
+ * Get share sharer
+ *
+ * @return IUser|string
+ * @since 9.0.0
+ */
+ public function getSharedBy();
+
+ /**
+ * Set the original share owner (who owns the path)
+ *
+ * @param IUser|string
+ * @return \OCP\Share\IShare The modified object
+ * @since 9.0.0
+ */
+ public function setShareOwner($shareOwner);
+
+ /**
+ * Get the original share owner (who owns the path)
+ *
+ * @return IUser|string
+ * @since 9.0.0
+ */
+ public function getShareOwner();
+
+ /**
+ * Set the password
+ *
+ * @param string $password
+ * @return \OCP\Share\IShare The modified object
+ * @since 9.0.0
+ */
+ public function setPassword($password);
+
+ /**
+ * Is a password set for this share
+ *
+ * @return string
+ * @since 9.0.0
+ */
+ public function getPassword();
+
+ /**
+ * Set the token
+ *
+ * @param string $token
+ * @return \OCP\Share\IShare The modified object
+ * @since 9.0.0
+ */
+ public function setToken($token);
+
+ /**
+ * Get the token
+ *
+ * @return string
+ * @since 9.0.0
+ */
+ public function getToken();
+
+ /**
+ * Get the parent it
+ *
+ * @return int
+ * @since 9.0.0
+ */
+ public function getParent();
+
+ /**
+ * Set the target of this share
+ *
+ * @param string $target
+ * @return \OCP\Share\IShare The modified object
+ * @since 9.0.0
+ */
+ public function setTarget($target);
+
+ /**
+ * Get the target of this share
+ *
+ * @return string
+ * @since 9.0.0
+ */
+ public function getTarget();
+
+ /**
+ * Set the time this share was created
+ *
+ * @param int $shareTime
+ * @return \OCP\Share\IShare The modified object
+ * @since 9.0.0
+ */
+ public function setShareTime($shareTime);
+
+ /**
+ * Get the timestamp this share was created
+ *
+ * @return int
+ * @since 9.0.0
+ */
+ public function getShareTime();
+
+ /**
+ * Set mailSend
+ *
+ * @param bool $mailSend
+ * @return \OCP\Share\IShare The modified object
+ * @since 9.0.0
+ */
+ public function setMailSend($mailSend);
+
+ /**
+ * Get mailSend
+ *
+ * @return bool
+ * @since 9.0.0
+ */
+ public function getMailSend();
+}
diff --git a/lib/public/share/ishareprovider.php b/lib/public/share/ishareprovider.php
new file mode 100644
index 00000000000..fa1b63d2d1a
--- /dev/null
+++ b/lib/public/share/ishareprovider.php
@@ -0,0 +1,134 @@
+<?php
+/**
+ * @author Roeland Jago Douma <rullzer@owncloud.com>
+ *
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCP\Share;
+
+use OC\Share20\Exception\ShareNotFound;
+use OC\Share20\Exception\BackendError;
+use OCP\IUser;
+
+/**
+ * Interface IShareProvider
+ *
+ * @package OCP\Share
+ * @since 9.0.0
+ */
+interface IShareProvider {
+
+ /**
+ * Return the identifier of this provider.
+ *
+ * @return string Containing only [a-zA-Z0-9]
+ * @since 9.0.0
+ */
+ public function identifier();
+
+ /**
+ * Share a path
+ *
+ * @param \OCP\Share\IShare $share
+ * @return \OCP\Share\IShare The share object
+ * @since 9.0.0
+ */
+ public function create(\OCP\Share\IShare $share);
+
+ /**
+ * Update a share
+ *
+ * @param \OCP\Share\IShare $share
+ * @return \OCP\Share\IShare The share object
+ * @since 9.0.0
+ */
+ public function update(\OCP\Share\IShare $share);
+
+ /**
+ * Delete a share
+ *
+ * @param \OCP\Share\IShare $share
+ * @since 9.0.0
+ */
+ public function delete(\OCP\Share\IShare $share);
+
+ /**
+ * Unshare a file from self as recipient.
+ * This may require special handling.
+ *
+ * @param \OCP\Share\IShare $share
+ * @param IUser $recipient
+ * @since 9.0.0
+ */
+ public function deleteFromSelf(\OCP\Share\IShare $share, IUser $recipient);
+
+ /**
+ * Get all shares by the given user
+ *
+ * @param IUser $user
+ * @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 Share[]
+ * @since 9.0.0
+ */
+ public function getSharesBy(IUser $user, $shareType, $node, $reshares, $limit, $offset);
+
+ /**
+ * Get share by id
+ *
+ * @param int $id
+ * @return IShare
+ * @throws ShareNotFound
+ * @since 9.0.0
+ */
+ public function getShareById($id);
+
+ /**
+ * Get shares for a given path
+ *
+ * @param \OCP\Files\Node $path
+ * @return IShare[]
+ * @since 9.0.0
+ */
+ public function getSharesByPath(\OCP\Files\Node $path);
+
+ /**
+ * Get shared with the given user
+ *
+ * @param IUser $user get shares where this user is the recipient
+ * @param int $shareType
+ * @param int $limit The max number of entries returned, -1 for all
+ * @param int $offset
+ * @param Share
+ * @since 9.0.0
+ */
+ public function getSharedWith(IUser $user, $shareType, $limit, $offset);
+
+ /**
+ * Get a share by token
+ *
+ * @param string $token
+ * @return IShare
+ * @throws ShareNotFound
+ * @since 9.0.0
+ */
+ public function getShareByToken($token);
+}