2012-10-14 23:04:08 +04:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-21 18:07:57 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* @author Bart Visscher <bartv@thisnet.nl>
|
2016-05-26 20:56:05 +03:00
|
|
|
* @author Björn Schießle <bjoern@schiessle.org>
|
2016-07-21 18:07:57 +03:00
|
|
|
* @author Joas Schilling <coding@schilljs.com>
|
2015-03-26 13:44:34 +03:00
|
|
|
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
|
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
2016-01-12 17:02:16 +03:00
|
|
|
* @author Robin McCorkell <robin@mccorkell.me.uk>
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2015-03-26 13:44:34 +03:00
|
|
|
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
2013-10-31 22:00:53 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* @license AGPL-3.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* 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.
|
2013-10-31 22:00:53 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2013-10-31 22:00:53 +04:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-03-26 13:44:34 +03:00
|
|
|
* 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,
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2013-10-31 22:00:53 +04:00
|
|
|
*
|
2015-02-26 13:37:37 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Public interface of ownCloud for apps to use.
|
|
|
|
* Share Class
|
2013-11-03 16:38:25 +04:00
|
|
|
*
|
|
|
|
*/
|
2015-02-26 13:37:37 +03:00
|
|
|
|
2013-11-03 16:38:25 +04:00
|
|
|
// use OCP namespace for all classes that are considered public.
|
|
|
|
// This means that they should be used by apps instead of the internal ownCloud classes
|
2019-11-22 22:52:10 +03:00
|
|
|
|
2012-10-14 23:04:08 +04:00
|
|
|
namespace OCP;
|
|
|
|
|
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* This class provides the ability for apps to share their content between users.
|
|
|
|
* Apps must create a backend class that implements OCP\Share_Backend and register it with this class.
|
|
|
|
*
|
|
|
|
* It provides the following hooks:
|
|
|
|
* - post_shared
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2019-04-18 18:44:14 +03:00
|
|
|
* @deprecated 17.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2014-02-18 18:07:03 +04:00
|
|
|
class Share extends \OC\Share\Constants {
|
2012-10-14 23:04:08 +04:00
|
|
|
|
2013-08-30 15:53:49 +04:00
|
|
|
/**
|
2013-10-17 02:07:29 +04:00
|
|
|
* Get the item of item type shared with a given user by source
|
2013-11-25 19:42:28 +04:00
|
|
|
* @param string $itemType
|
|
|
|
* @param string $itemSource
|
2014-11-10 15:08:45 +03:00
|
|
|
* @param string $user User to whom the item was shared
|
|
|
|
* @param string $owner Owner of the share
|
2013-09-24 21:37:24 +04:00
|
|
|
* @return array Return list of items with file_target, permissions and expiration
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0 - parameter $owner was added in 8.0.0
|
2019-04-18 18:44:14 +03:00
|
|
|
* @deprecated 17.0.0
|
2013-08-30 15:53:49 +04:00
|
|
|
*/
|
2014-11-10 15:08:45 +03:00
|
|
|
public static function getItemSharedWithUser($itemType, $itemSource, $user, $owner = null) {
|
|
|
|
return \OC\Share\Share::getItemSharedWithUser($itemType, $itemSource, $user, $owner);
|
2013-08-30 15:53:49 +04:00
|
|
|
}
|
|
|
|
|
2012-10-14 23:04:08 +04:00
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* Get the item of item type shared with the current user by source
|
2014-04-15 19:46:11 +04:00
|
|
|
* @param string $itemType
|
|
|
|
* @param string $itemSource
|
|
|
|
* @param int $format (optional) Format type must be defined by the backend
|
|
|
|
* @param mixed $parameters
|
|
|
|
* @param bool $includeCollections
|
2014-09-25 13:29:57 +04:00
|
|
|
* @return array
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2019-04-18 18:44:14 +03:00
|
|
|
* @deprecated 17.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2013-02-11 20:44:02 +04:00
|
|
|
public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE,
|
|
|
|
$parameters = null, $includeCollections = false) {
|
2019-04-18 18:44:14 +03:00
|
|
|
// not used by any app - only here to not break apps syntax
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|
|
|
|
|
2012-11-12 17:44:00 +04:00
|
|
|
/**
|
2014-01-21 13:42:47 +04:00
|
|
|
* Based on the given token the share information will be returned - password protected shares will be verified
|
|
|
|
* @param string $token
|
2015-04-28 09:40:47 +03:00
|
|
|
* @param bool $checkPasswordProtection
|
2014-05-11 21:28:45 +04:00
|
|
|
* @return array|bool false will be returned in case the token is unknown or unauthorized
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0 - parameter $checkPasswordProtection was added in 7.0.0
|
2019-04-18 18:44:14 +03:00
|
|
|
* @deprecated 17.0.0
|
2012-11-12 17:44:00 +04:00
|
|
|
*/
|
2014-01-21 13:42:47 +04:00
|
|
|
public static function getShareByToken($token, $checkPasswordProtection = true) {
|
2019-04-18 18:44:14 +03:00
|
|
|
// not used by any app - only here to not break apps syntax
|
2012-11-12 17:44:00 +04:00
|
|
|
}
|
|
|
|
|
2013-07-05 19:39:41 +04:00
|
|
|
|
2012-10-14 23:04:08 +04:00
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* Get the shared items of item type owned by the current user
|
2014-04-15 19:46:11 +04:00
|
|
|
* @param string $itemType
|
|
|
|
* @param int $format (optional) Format type must be defined by the backend
|
|
|
|
* @param mixed $parameters
|
|
|
|
* @param int $limit Number of items to return (optional) Returns all by default
|
|
|
|
* @param bool $includeCollections
|
|
|
|
* @return mixed Return depends on format
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2019-04-18 18:44:14 +03:00
|
|
|
* @deprecated 17.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2013-02-11 20:44:02 +04:00
|
|
|
public static function getItemsShared($itemType, $format = self::FORMAT_NONE, $parameters = null,
|
|
|
|
$limit = -1, $includeCollections = false) {
|
2014-02-18 15:37:32 +04:00
|
|
|
|
2019-04-18 18:44:14 +03:00
|
|
|
// only used by AppVNCSafe app (https://github.com/vnc-biz/nextcloud-appvncsafe/issues/2) - only here to not break apps syntax
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* Get the shared item of item type owned by the current user
|
2014-04-15 19:46:11 +04:00
|
|
|
* @param string $itemType
|
|
|
|
* @param string $itemSource
|
|
|
|
* @param int $format (optional) Format type must be defined by the backend
|
|
|
|
* @param mixed $parameters
|
|
|
|
* @param bool $includeCollections
|
|
|
|
* @return mixed Return depends on format
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2019-04-18 18:44:14 +03:00
|
|
|
* @deprecated 17.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2013-02-11 20:44:02 +04:00
|
|
|
public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE,
|
2020-04-09 10:22:29 +03:00
|
|
|
$parameters = null, $includeCollections = false) {
|
2014-02-18 15:37:32 +04:00
|
|
|
return \OC\Share\Share::getItemShared($itemType, $itemSource, $format, $parameters, $includeCollections);
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|
|
|
|
|
2013-08-30 15:53:49 +04:00
|
|
|
/**
|
2013-10-17 02:07:29 +04:00
|
|
|
* sent status if users got informed by mail about share
|
2013-08-30 15:53:49 +04:00
|
|
|
* @param string $itemType
|
|
|
|
* @param string $itemSource
|
|
|
|
* @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
|
2014-08-13 19:02:51 +04:00
|
|
|
* @param string $recipient with whom was the item shared
|
2013-08-30 15:53:49 +04:00
|
|
|
* @param bool $status
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0 - parameter $originIsSource was added in 8.0.0
|
2019-04-18 18:44:14 +03:00
|
|
|
* @deprecated 17.0.0
|
2013-08-30 15:53:49 +04:00
|
|
|
*/
|
2014-08-13 19:02:51 +04:00
|
|
|
public static function setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status) {
|
2019-04-18 18:44:14 +03:00
|
|
|
// not used by any app - only here to not break apps syntax
|
2013-08-30 15:53:49 +04:00
|
|
|
}
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|