2012-10-14 23:04:08 +04:00
|
|
|
<?php
|
|
|
|
/**
|
2015-03-26 13:44:34 +03:00
|
|
|
* @author Andreas Fischer <bantu@owncloud.com>
|
|
|
|
* @author Bart Visscher <bartv@thisnet.nl>
|
|
|
|
* @author Björn Schießle <schiessle@owncloud.com>
|
|
|
|
* @author Joas Schilling <nickvergessen@owncloud.com>
|
|
|
|
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
|
|
|
|
* @author Michael Gapczynski <GapczynskiM@gmail.com>
|
|
|
|
* @author Michael Kuhn <suraia@ikkoku.de>
|
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
|
|
|
* @author Robin McCorkell <rmccorkell@karoshi.org.uk>
|
|
|
|
* @author Sam Tuke <mail@samtuke.com>
|
|
|
|
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
2013-10-31 22:00:53 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* @copyright Copyright (c) 2015, ownCloud, Inc.
|
|
|
|
* @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,
|
|
|
|
* 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
|
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
|
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-10-31 22:00:53 +04:00
|
|
|
* Register a sharing backend class that implements OCP\Share_Backend for an item type
|
2014-04-15 19:46:11 +04:00
|
|
|
* @param string $itemType Item type
|
|
|
|
* @param string $class Backend class
|
|
|
|
* @param string $collectionOf (optional) Depends on item type
|
|
|
|
* @param array $supportedFileExtensions (optional) List of supported file extensions if this item type depends on files
|
|
|
|
* @return boolean true if backend is registered or false if error
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2012-10-14 23:04:08 +04:00
|
|
|
public static function registerBackend($itemType, $class, $collectionOf = null, $supportedFileExtensions = null) {
|
2014-02-18 15:37:32 +04:00
|
|
|
return \OC\Share\Share::registerBackend($itemType, $class, $collectionOf, $supportedFileExtensions);
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* Check if the Share API is enabled
|
2014-04-15 19:46:11 +04:00
|
|
|
* @return boolean true if enabled or false
|
2013-10-31 22:00:53 +04:00
|
|
|
*
|
|
|
|
* The Share API is enabled by default if not configured
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2012-10-14 23:04:08 +04:00
|
|
|
public static function isEnabled() {
|
2014-02-18 15:37:32 +04:00
|
|
|
return \OC\Share\Share::isEnabled();
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|
2013-08-30 15:53:49 +04:00
|
|
|
|
2013-02-09 22:39:32 +04:00
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* Find which users can access a shared item
|
2014-03-31 20:09:46 +04:00
|
|
|
* @param string $path to the file
|
2014-04-02 14:54:41 +04:00
|
|
|
* @param string $ownerUser owner of the file
|
2014-03-31 20:09:46 +04:00
|
|
|
* @param bool $includeOwner include owner to the list of users with access to the file
|
2014-04-02 14:54:41 +04:00
|
|
|
* @param bool $returnUserPaths Return an array with the user => path map
|
2013-10-31 22:00:53 +04:00
|
|
|
* @return array
|
|
|
|
* @note $path needs to be relative to user data dir, e.g. 'file.txt'
|
|
|
|
* not '/admin/data/file.txt'
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2014-04-02 14:54:41 +04:00
|
|
|
public static function getUsersSharingFile($path, $ownerUser, $includeOwner = false, $returnUserPaths = false) {
|
|
|
|
return \OC\Share\Share::getUsersSharingFile($path, $ownerUser, $includeOwner, $returnUserPaths);
|
2013-02-09 22:39:32 +04:00
|
|
|
}
|
2012-10-14 23:04:08 +04:00
|
|
|
|
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* Get the items of item type shared with 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 (optional)
|
|
|
|
* @param int $limit Number of items to return (optional) Returns all by default
|
|
|
|
* @param bool $includeCollections (optional)
|
|
|
|
* @return mixed Return depends on format
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2013-02-11 20:44:02 +04:00
|
|
|
public static function getItemsSharedWith($itemType, $format = self::FORMAT_NONE,
|
|
|
|
$parameters = null, $limit = -1, $includeCollections = false) {
|
2014-02-18 15:37:32 +04:00
|
|
|
|
|
|
|
return \OC\Share\Share::getItemsSharedWith($itemType, $format, $parameters, $limit, $includeCollections);
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|
|
|
|
|
2014-04-08 16:42:15 +04:00
|
|
|
/**
|
|
|
|
* Get the items of item type shared with a user
|
2014-05-12 00:51:30 +04:00
|
|
|
* @param string $itemType
|
|
|
|
* @param string $user for which user we want the shares
|
|
|
|
* @param int $format (optional) Format type must be defined by the backend
|
|
|
|
* @param mixed $parameters (optional)
|
|
|
|
* @param int $limit Number of items to return (optional) Returns all by default
|
|
|
|
* @param bool $includeCollections (optional)
|
|
|
|
* @return mixed Return depends on format
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 7.0.0
|
2014-04-08 16:42:15 +04:00
|
|
|
*/
|
|
|
|
public static function getItemsSharedWithUser($itemType, $user, $format = self::FORMAT_NONE,
|
|
|
|
$parameters = null, $limit = -1, $includeCollections = false) {
|
|
|
|
|
|
|
|
return \OC\Share\Share::getItemsSharedWithUser($itemType, $user, $format, $parameters, $limit, $includeCollections);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
* @param string $itemType
|
2013-11-25 19:42:28 +04:00
|
|
|
* @param string $itemTarget
|
2013-10-31 22:00:53 +04:00
|
|
|
* @param int $format (optional) Format type must be defined by the backend
|
2014-05-12 00:51:30 +04:00
|
|
|
* @param mixed $parameters (optional)
|
|
|
|
* @param bool $includeCollections (optional)
|
2014-04-15 19:46:11 +04:00
|
|
|
* @return mixed Return depends on format
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2013-02-11 20:44:02 +04:00
|
|
|
public static function getItemSharedWith($itemType, $itemTarget, $format = self::FORMAT_NONE,
|
|
|
|
$parameters = null, $includeCollections = false) {
|
2014-02-18 15:37:32 +04:00
|
|
|
|
|
|
|
return \OC\Share\Share::getItemSharedWith($itemType, $itemTarget, $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
|
|
|
* 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
|
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
|
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) {
|
2014-02-18 15:37:32 +04:00
|
|
|
return \OC\Share\Share::getItemSharedWithBySource($itemType, $itemSource, $format, $parameters, $includeCollections);
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* Get the item of item type shared by a link
|
2014-04-15 19:46:11 +04:00
|
|
|
* @param string $itemType
|
|
|
|
* @param string $itemSource
|
|
|
|
* @param string $uidOwner Owner of link
|
2015-04-28 09:40:47 +03:00
|
|
|
* @return array
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2012-10-14 23:04:08 +04:00
|
|
|
public static function getItemSharedWithByLink($itemType, $itemSource, $uidOwner) {
|
2014-02-18 15:37:32 +04:00
|
|
|
return \OC\Share\Share::getItemSharedWithByLink($itemType, $itemSource, $uidOwner);
|
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
|
2012-11-12 17:44:00 +04:00
|
|
|
*/
|
2014-01-21 13:42:47 +04:00
|
|
|
public static function getShareByToken($token, $checkPasswordProtection = true) {
|
2014-02-18 15:37:32 +04:00
|
|
|
return \OC\Share\Share::getShareByToken($token, $checkPasswordProtection);
|
2012-11-12 17:44:00 +04:00
|
|
|
}
|
|
|
|
|
2013-07-05 19:39:41 +04:00
|
|
|
/**
|
2013-10-17 02:07:29 +04:00
|
|
|
* resolves reshares down to the last real share
|
2014-05-12 00:51:30 +04:00
|
|
|
* @param array $linkItem
|
|
|
|
* @return array file owner
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-07-05 19:39:41 +04:00
|
|
|
*/
|
2014-02-18 15:37:32 +04:00
|
|
|
public static function resolveReShare($linkItem) {
|
|
|
|
return \OC\Share\Share::resolveReShare($linkItem);
|
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
|
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
|
|
|
|
|
|
|
return \OC\Share\Share::getItemsShared($itemType, $format, $parameters, $limit, $includeCollections);
|
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
|
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,
|
2013-07-05 15:45:21 +04: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-02-26 10:21:48 +04:00
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* Get all users an item is shared with
|
2014-04-15 19:46:11 +04:00
|
|
|
* @param string $itemType
|
|
|
|
* @param string $itemSource
|
|
|
|
* @param string $uidOwner
|
|
|
|
* @param bool $includeCollections
|
|
|
|
* @param bool $checkExpireDate
|
2014-05-12 00:51:30 +04:00
|
|
|
* @return array Return array of users
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0 - parameter $checkExpireDate was added in 7.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2013-12-05 20:26:30 +04:00
|
|
|
public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false, $checkExpireDate = true) {
|
2014-02-18 15:37:32 +04:00
|
|
|
return \OC\Share\Share::getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections, $checkExpireDate);
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-10-23 20:39:37 +04:00
|
|
|
* Share an item with a user, group, or via private link
|
|
|
|
* @param string $itemType
|
|
|
|
* @param string $itemSource
|
|
|
|
* @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
|
|
|
|
* @param string $shareWith User or group the item is being shared with
|
|
|
|
* @param int $permissions CRUDS
|
2014-05-07 13:23:50 +04:00
|
|
|
* @param string $itemSourceName
|
|
|
|
* @param \DateTime $expirationDate
|
2013-10-23 20:39:37 +04:00
|
|
|
* @return bool|string Returns true on success or false on failure, Returns token on success for links
|
2014-05-07 13:23:50 +04:00
|
|
|
* @throws \Exception
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0 - parameter $itemSourceName was added in 6.0.0, parameter $expirationDate was added in 7.0.0
|
2013-10-23 20:39:37 +04:00
|
|
|
*/
|
2014-05-07 13:23:50 +04:00
|
|
|
public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null, \DateTime $expirationDate = null) {
|
|
|
|
return \OC\Share\Share::shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName, $expirationDate);
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* Unshare an item from a user, group, or delete a private link
|
2014-04-15 19:46:11 +04:00
|
|
|
* @param string $itemType
|
|
|
|
* @param string $itemSource
|
|
|
|
* @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
|
|
|
|
* @param string $shareWith User or group the item is being shared with
|
2014-11-24 17:31:52 +03:00
|
|
|
* @param string $owner owner of the share, if null the current user is used
|
2014-04-15 19:46:11 +04:00
|
|
|
* @return boolean true on success or false on failure
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0 - parameter $owner was added in 8.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2014-11-24 17:31:52 +03:00
|
|
|
public static function unshare($itemType, $itemSource, $shareType, $shareWith, $owner = null) {
|
|
|
|
return \OC\Share\Share::unshare($itemType, $itemSource, $shareType, $shareWith, $owner);
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|
|
|
|
|
2012-10-16 23:38:52 +04:00
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* Unshare an item from all users, groups, and remove all links
|
2014-04-15 19:46:11 +04:00
|
|
|
* @param string $itemType
|
|
|
|
* @param string $itemSource
|
|
|
|
* @return boolean true on success or false on failure
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2012-10-16 23:38:52 +04:00
|
|
|
public static function unshareAll($itemType, $itemSource) {
|
2014-02-18 15:37:32 +04:00
|
|
|
return \OC\Share\Share::unshareAll($itemType, $itemSource);
|
2012-10-16 23:38:52 +04:00
|
|
|
}
|
|
|
|
|
2012-10-14 23:04:08 +04:00
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* Unshare an item shared with the current user
|
2014-04-15 19:46:11 +04:00
|
|
|
* @param string $itemType
|
2015-04-28 09:40:47 +03:00
|
|
|
* @param string $itemOrigin Item target or source
|
|
|
|
* @param boolean $originIsSource true if $itemOrigin is the source, false if $itemOrigin is the target (optional)
|
2014-04-15 19:46:11 +04:00
|
|
|
* @return boolean true on success or false on failure
|
2013-10-31 22:00:53 +04:00
|
|
|
*
|
|
|
|
* Unsharing from self is not allowed for items inside collections
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0 - parameter $originIsSource was added in 8.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2014-07-26 04:00:49 +04:00
|
|
|
public static function unshareFromSelf($itemType, $itemOrigin, $originIsSource = false) {
|
|
|
|
return \OC\Share\Share::unshareFromSelf($itemType, $itemOrigin, $originIsSource);
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|
2014-04-15 19:46:11 +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
|
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) {
|
|
|
|
return \OC\Share\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status);
|
2013-08-30 15:53:49 +04:00
|
|
|
}
|
2012-10-14 23:04:08 +04:00
|
|
|
|
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* Set the permissions of an item for a specific user or group
|
2014-04-15 19:46:11 +04:00
|
|
|
* @param string $itemType
|
|
|
|
* @param string $itemSource
|
|
|
|
* @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
|
|
|
|
* @param string $shareWith User or group the item is being shared with
|
|
|
|
* @param int $permissions CRUDS permissions
|
|
|
|
* @return boolean true on success or false on failure
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2012-10-14 23:04:08 +04:00
|
|
|
public static function setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions) {
|
2014-02-18 15:37:32 +04:00
|
|
|
return \OC\Share\Share::setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions);
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|
|
|
|
|
2013-10-31 22:00:53 +04:00
|
|
|
/**
|
|
|
|
* Set expiration date for a share
|
|
|
|
* @param string $itemType
|
|
|
|
* @param string $itemSource
|
|
|
|
* @param string $date expiration date
|
2014-07-23 18:42:33 +04:00
|
|
|
* @param int $shareTime timestamp from when the file was shared
|
2014-04-15 19:46:11 +04:00
|
|
|
* @return boolean
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0 - parameter $shareTime was added in 8.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2014-07-23 18:42:33 +04:00
|
|
|
public static function setExpirationDate($itemType, $itemSource, $date, $shareTime = null) {
|
|
|
|
return \OC\Share\Share::setExpirationDate($itemType, $itemSource, $date, $shareTime);
|
2013-09-23 18:22:48 +04:00
|
|
|
}
|
|
|
|
|
2015-03-13 14:29:13 +03:00
|
|
|
/**
|
|
|
|
* Set expiration date for a share
|
|
|
|
* @param int $shareId
|
|
|
|
* @param string $password
|
|
|
|
* @return boolean
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-03-13 14:29:13 +03:00
|
|
|
*/
|
|
|
|
public static function setPassword($shareId, $password) {
|
|
|
|
$userSession = \OC::$server->getUserSession();
|
|
|
|
$connection = \OC::$server->getDatabaseConnection();
|
|
|
|
$config = \OC::$server->getConfig();
|
|
|
|
return \OC\Share\Share::setPassword($userSession, $connection, $config, $shareId, $password);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-14 23:04:08 +04:00
|
|
|
/**
|
2013-10-31 22:00:53 +04:00
|
|
|
* Get the backend class for the specified item type
|
|
|
|
* @param string $itemType
|
|
|
|
* @return Share_Backend
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2013-10-31 22:00:53 +04:00
|
|
|
*/
|
2013-07-26 16:11:59 +04:00
|
|
|
public static function getBackend($itemType) {
|
2014-02-18 15:37:32 +04:00
|
|
|
return \OC\Share\Share::getBackend($itemType);
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|
|
|
|
|
2013-10-18 13:37:13 +04:00
|
|
|
/**
|
|
|
|
* Delete all shares with type SHARE_TYPE_LINK
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-10-18 13:37:13 +04:00
|
|
|
*/
|
|
|
|
public static function removeAllLinkShares() {
|
2014-02-18 15:37:32 +04:00
|
|
|
return \OC\Share\Share::removeAllLinkShares();
|
2013-10-18 13:37:13 +04:00
|
|
|
}
|
|
|
|
|
2014-01-21 13:42:47 +04:00
|
|
|
/**
|
|
|
|
* In case a password protected link is not yet authenticated this function will return false
|
|
|
|
*
|
|
|
|
* @param array $linkItem
|
|
|
|
* @return bool
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 7.0.0
|
2014-01-21 13:42:47 +04:00
|
|
|
*/
|
|
|
|
public static function checkPasswordProtectedShare(array $linkItem) {
|
2014-02-18 15:37:32 +04:00
|
|
|
return \OC\Share\Share::checkPasswordProtectedShare($linkItem);
|
2014-01-21 13:42:47 +04:00
|
|
|
}
|
2014-08-05 12:57:13 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if resharing is allowed
|
|
|
|
*
|
|
|
|
* @return boolean true if allowed or false
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 5.0.0
|
2014-08-05 12:57:13 +04:00
|
|
|
*/
|
|
|
|
public static function isResharingAllowed() {
|
|
|
|
return \OC\Share\Share::isResharingAllowed();
|
|
|
|
}
|
2012-10-14 23:04:08 +04:00
|
|
|
}
|