Share extends Constants
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
Tags
Table of Contents
- getItemShared() : mixed
- Get the shared item of item type owned by the current user
- getItemSharedWithBySource() : array
- Get the item of item type shared with the current user by source
- getItemSharedWithUser() : array
- Get the item of item type shared with a given user by source
- getItemsShared() : mixed
- Get the shared items of item type owned by the current user
- getShareByToken() : array|bool
- Based on the given token the share information will be returned - password protected shares will be verified
- setSendMailStatus() : mixed
- sent status if users got informed by mail about share
Methods
getItemShared()
Get the shared item of item type owned by the current user
public
static getItemShared(string $itemType, string $itemSource[, int $format = self::FORMAT_NONE ][, mixed $parameters = null ][, bool $includeCollections = false ]) : mixed
Parameters
- $itemType : string
- $itemSource : string
- $format : int = self::FORMAT_NONE
-
(optional) Format type must be defined by the backend
- $parameters : mixed = null
- $includeCollections : bool = false
Tags
Return values
mixed —Return depends on format
getItemSharedWithBySource()
Get the item of item type shared with the current user by source
public
static getItemSharedWithBySource(string $itemType, string $itemSource[, int $format = self::FORMAT_NONE ][, mixed $parameters = null ][, bool $includeCollections = false ]) : array
Parameters
- $itemType : string
- $itemSource : string
- $format : int = self::FORMAT_NONE
-
(optional) Format type must be defined by the backend
- $parameters : mixed = null
- $includeCollections : bool = false
Tags
Return values
array —getItemSharedWithUser()
Get the item of item type shared with a given user by source
public
static getItemSharedWithUser(string $itemType, string $itemSource, string $user[, string $owner = null ]) : array
Parameters
- $itemType : string
- $itemSource : string
- $user : string
-
User to whom the item was shared
- $owner : string = null
-
Owner of the share
Tags
Return values
array —Return list of items with file_target, permissions and expiration
getItemsShared()
Get the shared items of item type owned by the current user
public
static getItemsShared(string $itemType[, int $format = self::FORMAT_NONE ][, mixed $parameters = null ][, int $limit = -1 ][, bool $includeCollections = false ]) : mixed
Parameters
- $itemType : string
- $format : int = self::FORMAT_NONE
-
(optional) Format type must be defined by the backend
- $parameters : mixed = null
- $limit : int = -1
-
Number of items to return (optional) Returns all by default
- $includeCollections : bool = false
Tags
Return values
mixed —Return depends on format
getShareByToken()
Based on the given token the share information will be returned - password protected shares will be verified
public
static getShareByToken(string $token[, bool $checkPasswordProtection = true ]) : array|bool
Parameters
- $token : string
- $checkPasswordProtection : bool = true
Tags
Return values
array|bool —false will be returned in case the token is unknown or unauthorized
setSendMailStatus()
sent status if users got informed by mail about share
public
static setSendMailStatus(string $itemType, string $itemSource, int $shareType, string $recipient, bool $status) : mixed
Parameters
- $itemType : string
- $itemSource : string
- $shareType : int
-
SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
- $recipient : string
-
with whom was the item shared
- $status : bool