IManager

interface OCP\Share\IManager
Interface IManager
Implemented by:OC\Share20\Manager
Source:lib/public/Share/IManager.php#44

Methods

public OCP\Share\IManager::createShare($share)
Create a Share
Source:

lib/public/Share/IManager.php#54

Parameters:
Returns:

\OCP\Share\IShare The share object

Throws:

\Exception

Since:

9.0.0

public OCP\Share\IManager::updateShare($share)
Update a share.
The target of the share can’t be changed this way: use moveShare
The share can’t be removed this way (permission 0): use deleteShare
The state can’t be changed this way: use acceptShare
Source:

lib/public/Share/IManager.php#67

Parameters:
Returns:

\OCP\Share\IShare The share object

Throws:

\InvalidArgumentException

Since:

9.0.0

public OCP\Share\IManager::acceptShare($share, $recipientId)
Accept a share.
Source:

lib/public/Share/IManager.php#78

Parameters:
Returns:

\OCP\Share\IShare The share object

Throws:

\InvalidArgumentException

Since:

18.0.0

public OCP\Share\IManager::deleteShare($share)
Delete a share
Source:

lib/public/Share/IManager.php#88

Parameters:
Throws:

\OCP\Share\Exceptions\ShareNotFound

Throws:

\InvalidArgumentException

Throws:

\OCP\Share\Exceptions\ShareNotFound

Throws:

\InvalidArgumentException

Since:

9.0.0

public OCP\Share\IManager::deleteFromSelf($share, $recipientId)
Unshare a file as the recipient.
This can be different from a regular delete for example when one of
the users in a groups deletes that share. But the provider should
handle this.
Source:

lib/public/Share/IManager.php#100

Parameters:
Since:

9.0.0

public OCP\Share\IManager::restoreShare($share, $recipientId)
Restore the share when it has been deleted
Certain share types can be restored when they have been deleted
but the provider should properly handle this\
Source:

lib/public/Share/IManager.php#114

Parameters:
  • $share (OCP\Share\IShare) The share to restore
  • $recipientId (string) The user to restore the share for
Returns:

\OCP\Share\IShare The restored share object

Throws:

\OCP\Share\Exceptions\GenericShareException In case restoring the share failed

Since:

14.0.0

public OCP\Share\IManager::moveShare($share, $recipientId)
Move the share as a recipient of the share.
This is updating the share target. So where the recipient has the share mounted.
Source:

lib/public/Share/IManager.php#126

Parameters:
Returns:

\OCP\Share\IShare

Throws:

\InvalidArgumentException If $share is a link share or the $recipient does not match

Since:

9.0.0

public OCP\Share\IManager::getSharesInFolder($userId, $node, $reshares=false)
Get all shares shared by (initiated) by the provided user in a folder.
Source:

lib/public/Share/IManager.php#137

Parameters:
Returns:

\OCP\Share\IShare[][] [$fileId => IShare[], ...]

Since:

11.0.0

public OCP\Share\IManager::getSharesBy($userId, $shareType, $path=null, $reshares=false, $limit=50, $offset=0)
Get shares shared by (initiated) by the provided user.
Source:

lib/public/Share/IManager.php#151

Parameters:
  • $userId (string)
  • $shareType (int)
  • $path (OCP\Files\Node | null)
  • $reshares (bool)
  • $limit (int) The maximum number of returned results, -1 for all results
  • $offset (int)
Returns:

\OCP\Share\IShare[]

Since:

9.0.0

public OCP\Share\IManager::getSharedWith($userId, $shareType, $node=null, $limit=50, $offset=0)
Get shares shared with $user.
Filter by $node if provided
Source:

lib/public/Share/IManager.php#165

Parameters:
  • $userId (string)
  • $shareType (int)
  • $node (OCP\Files\Node | null)
  • $limit (int) The maximum number of shares returned, -1 for all
  • $offset (int)
Returns:

\OCP\Share\IShare[]

Since:

9.0.0

public OCP\Share\IManager::getDeletedSharedWith($userId, $shareType, $node=null, $limit=50, $offset=0)
Get deleted shares shared with $user.
Filter by $node if provided
Source:

lib/public/Share/IManager.php#179

Parameters:
  • $userId (string)
  • $shareType (int)
  • $node (OCP\Files\Node | null)
  • $limit (int) The maximum number of shares returned, -1 for all
  • $offset (int)
Returns:

\OCP\Share\IShare[]

Since:

14.0.0

public OCP\Share\IManager::getShareById($id, $recipient=null)
Retrieve a share by the share id.
If the recipient is set make sure to retrieve the file for that user.
This makes sure that if a user has moved/deleted a group share this
is reflected.
Source:

lib/public/Share/IManager.php#193

Parameters:
  • $id (string)
  • $recipient (string | null) userID of the recipient
Returns:

\OCP\Share\IShare

Throws:

\OCP\Share\Exceptions\ShareNotFound

Since:

9.0.0

public OCP\Share\IManager::getShareByToken($token)
Get the share by token possible with password
Source:

lib/public/Share/IManager.php#203

Parameters:
  • $token (string)
Returns:

\OCP\Share\IShare

Throws:

\OCP\Share\Exceptions\ShareNotFound

Since:

9.0.0

public OCP\Share\IManager::checkPassword($share, $password)
Verify the password of a public share
Source:

lib/public/Share/IManager.php#213

Parameters:
Returns:

bool

Since:

9.0.0

public OCP\Share\IManager::userDeleted($uid)
The user with UID is deleted.
All share providers have to cleanup the shares with this user as well
as shares owned by this user.
Shares only initiated by this user are fine.
Source:

lib/public/Share/IManager.php#224

Parameters:
  • $uid (string)
Since:

9.1.0

public OCP\Share\IManager::groupDeleted($gid)
The group with $gid is deleted
We need to clear up all shares to this group
Source:

lib/public/Share/IManager.php#233

Parameters:
  • $gid (string)
Since:

9.1.0

public OCP\Share\IManager::userDeletedFromGroup($uid, $gid)
The user $uid is deleted from the group $gid
All user specific group shares have to be removed
Source:

lib/public/Share/IManager.php#243

Parameters:
  • $uid (string)
  • $gid (string)
Since:

9.1.0

public OCP\Share\IManager::getAccessList($path, $recursive=true, $currentAccess=false)
Get access list to a path. This means
all the users that can access a given path.
Consider:
-root
|-folder1 (23)
|-folder2 (32)
|-fileA (42)

fileA is shared with user1 and user1@server1
folder2 is shared with group2 (user4 is a member of group2)
folder1 is shared with user2 (renamed to “folder (1)”) and user2@server2

Then the access list to ‘/folder1/folder2/fileA’ with $currentAccess is:
[
users => [
‘user1’ => [‘node_id’ => 42, ‘node_path’ => ‘/fileA’],
‘user4’ => [‘node_id’ => 32, ‘node_path’ => ‘/folder2’],
‘user2’ => [‘node_id’ => 23, ‘node_path’ => ‘/folder (1)’],
],
remote => [
'user1@server1‘ => [‘node_id’ => 42, ‘token’ => ‘SeCr3t’],
'user2@server2‘ => [‘node_id’ => 23, ‘token’ => ‘FooBaR’],
],
public => bool
mail => bool
]

The access list to ‘/folder1/folder2/fileA’ **without** $currentAccess is:
[
users => [‘user1’, ‘user2’, ‘user4’],
remote => bool,
public => bool
mail => bool
]

This is required for encryption/activity
Source:

lib/public/Share/IManager.php#290

Parameters:
  • $path (OCP\Files\Node)
  • $recursive (bool) Should we check all parent folders as well
  • $currentAccess (bool) Should the user have currently access to the file
Returns:

array

Since:

12

public OCP\Share\IManager::newShare()
Instantiates a new share object. This is to be passed to
createShare.
Source:lib/public/Share/IManager.php#299
Returns:\OCP\Share\IShare
Since:9.0.0
public OCP\Share\IManager::shareApiEnabled()
Is the share API enabled
Source:lib/public/Share/IManager.php#307
Returns:bool
Since:9.0.0
Is public link sharing enabled
Source:lib/public/Share/IManager.php#315
Returns:bool
Since:9.0.0
public OCP\Share\IManager::shareApiLinkEnforcePassword()
Is password on public link requires
Source:lib/public/Share/IManager.php#323
Returns:bool
Since:9.0.0
public OCP\Share\IManager::shareApiLinkDefaultExpireDate()
Is default expire date enabled
Source:lib/public/Share/IManager.php#331
Returns:bool
Since:9.0.0
public OCP\Share\IManager::shareApiLinkDefaultExpireDateEnforced()
Is default expire date enforced
`
Source:lib/public/Share/IManager.php#339
Returns:bool
Since:9.0.0
public OCP\Share\IManager::shareApiLinkDefaultExpireDays()
Number of default expire days
Source:lib/public/Share/IManager.php#347
Returns:int
Since:9.0.0
public OCP\Share\IManager::shareApiLinkAllowPublicUpload()
Allow public upload on link shares
Source:lib/public/Share/IManager.php#355
Returns:bool
Since:9.0.0
public OCP\Share\IManager::shareWithGroupMembersOnly()
check if user can only share with group members
Source:lib/public/Share/IManager.php#362
Returns:bool
Since:9.0.0
public OCP\Share\IManager::allowGroupSharing()
Check if users can share with groups
Source:lib/public/Share/IManager.php#369
Returns:bool
Since:9.0.1
public OCP\Share\IManager::allowEnumeration()
Check if user enumeration is allowed
Source:lib/public/Share/IManager.php#377
Returns:bool
Since:19.0.0
public OCP\Share\IManager::limitEnumerationToGroups()
Check if user enumeration is limited to the users groups
Source:lib/public/Share/IManager.php#385
Returns:bool
Since:19.0.0
public OCP\Share\IManager::limitEnumerationToPhone()
Check if user enumeration is limited to the phonebook matches
Source:lib/public/Share/IManager.php#393
Returns:bool
Since:21.0.1
public OCP\Share\IManager::allowEnumerationFullMatch()
Check if user enumeration is allowed to return on full match
Source:lib/public/Share/IManager.php#401
Returns:bool
Since:21.0.1
public OCP\Share\IManager::sharingDisabledForUser($userId)
Check if sharing is disabled for the given user
Source:

lib/public/Share/IManager.php#410

Parameters:
  • $userId (string)
Returns:

bool

Since:

9.0.0

public OCP\Share\IManager::outgoingServer2ServerSharesAllowed()
Check if outgoing server2server shares are allowed
Source:lib/public/Share/IManager.php#417
Returns:bool
Since:9.0.0
public OCP\Share\IManager::outgoingServer2ServerGroupSharesAllowed()
Check if outgoing server2server shares are allowed
Source:lib/public/Share/IManager.php#424
Returns:bool
Since:14.0.0
public OCP\Share\IManager::shareProviderExists($shareType)
Check if a given share provider exists
Source:

lib/public/Share/IManager.php#433

Parameters:
  • $shareType (int)
Returns:

bool

Since:

11.0.0

public OCP\Share\IManager::registerShareProvider($shareProviderClass)
Source:

lib/public/Share/IManager.php#439

Parameters:
  • $shareProviderClass (string)
Since:

21.0.0

public OCP\Share\IManager::getAllShares()
Source:lib/public/Share/IManager.php#451
Returns:iterable
Since:18.0.0