Share

class OCP\Share
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
Source:lib/public/Share.php#51
Parent:OC\Share\Constants

Methods

public static OCP\Share::getItemSharedWithUser($itemType, $itemSource, $user, $owner=null)
Get the item of item type shared with a given user by source
Source:

lib/public/Share.php#63

Parameters:
  • $itemType (string)
  • $itemSource (string)
  • $user (string) User to whom the item was shared
  • $owner (string) Owner of the share
Returns:

array Return list of items with file_target, permissions and expiration

Since:

6.0.0 - parameter $owner was added in 8.0.0

Deprecated:

17.0.0

public static OCP\Share::getItemSharedWithBySource($itemType, $itemSource, $format=self::FORMAT_NONE, $parameters=null, $includeCollections=false)
Get the item of item type shared with the current user by source
Source:

lib/public/Share.php#78

Parameters:
  • $itemType (string)
  • $itemSource (string)
  • $format (int) (optional) Format type must be defined by the backend
  • $parameters (mixed)
  • $includeCollections (bool)
Returns:

array

Since:

5.0.0

Deprecated:

17.0.0

public static OCP\Share::getShareByToken($token, $checkPasswordProtection=true)
Based on the given token the share information will be returned - password protected shares will be verified
Source:

lib/public/Share.php#91

Parameters:
  • $token (string)
  • $checkPasswordProtection (bool)
Returns:

array | bool false will be returned in case the token is unknown or unauthorized

Since:

5.0.0 - parameter $checkPasswordProtection was added in 7.0.0

Deprecated:

17.0.0

public static OCP\Share::getItemsShared($itemType, $format=self::FORMAT_NONE, $parameters=null, $limit=-1, $includeCollections=false)
Get the shared items of item type owned by the current user
Source:

lib/public/Share.php#107

Parameters:
  • $itemType (string)
  • $format (int) (optional) Format type must be defined by the backend
  • $parameters (mixed)
  • $limit (int) Number of items to return (optional) Returns all by default
  • $includeCollections (bool)
Returns:

mixed Return depends on format

Since:

5.0.0

Deprecated:

17.0.0

public static OCP\Share::getItemShared($itemType, $itemSource, $format=self::FORMAT_NONE, $parameters=null, $includeCollections=false)
Get the shared item of item type owned by the current user
Source:

lib/public/Share.php#127

Parameters:
  • $itemType (string)
  • $itemSource (string)
  • $format (int) (optional) Format type must be defined by the backend
  • $parameters (mixed)
  • $includeCollections (bool)
Returns:

mixed Return depends on format

Since:

5.0.0

Deprecated:

17.0.0 Refactoring notes: * defacto $parameters and $format is always the default and therefore is removed in the subsequent call

public static OCP\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status)
sent status if users got informed by mail about share
Source:

lib/public/Share.php#142

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)
Since:

6.0.0 - parameter $originIsSource was added in 8.0.0

Deprecated:

17.0.0