Methods

createShare()

createShare(\OCP\Share\IShare  $share) : \OCP\Share\IShare

Create a Share

Parameters

\OCP\Share\IShare $share

Returns

\OCP\Share\IShare

The share object

updateShare()

updateShare(\OCP\Share\IShare  $share) : \OCP\Share\IShare

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

Parameters

\OCP\Share\IShare $share

Returns

\OCP\Share\IShare

The share object

deleteShare()

deleteShare(\OCP\Share\IShare  $share) 

Delete a share

Parameters

\OCP\Share\IShare $share

Throws

\OCP\Share\Exceptions\ShareNotFound

deleteFromSelf()

deleteFromSelf(\OCP\Share\IShare  $share, string  $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.

Parameters

\OCP\Share\IShare $share
string $recipientId

moveShare()

moveShare(\OCP\Share\IShare  $share, string  $recipientId) : \OCP\Share\IShare

Move the share as a recipient of the share.

This is updating the share target. So where the recipient has the share mounted.

Parameters

\OCP\Share\IShare $share
string $recipientId

Throws

\InvalidArgumentException

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

Returns

\OCP\Share\IShare

getAllSharesBy()

getAllSharesBy(string  $userId, array<mixed,integer>  $shareTypes, array<mixed,integer>  $nodeIDs, boolean  $reshares = false) : array<mixed,\OCP\Share\IShare>

Get all shares shared by (initiated) by the provided user for specific node IDs.

Parameters

string $userId
array<mixed,integer> $shareTypes
array<mixed,integer> $nodeIDs
boolean $reshares

Returns

array<mixed,\OCP\Share\IShare>

getSharesBy()

getSharesBy(string  $userId, integer  $shareType, \OCP\Files\Node|null  $path = null, boolean  $reshares = false, integer  $limit = 50, integer  $offset) : array<mixed,\OCP\Share\IShare>

Get shares shared by (initiated) by the provided user.

Parameters

string $userId
integer $shareType
\OCP\Files\Node|null $path
boolean $reshares
integer $limit

The maximum number of returned results, -1 for all results

integer $offset

Returns

array<mixed,\OCP\Share\IShare>

getSharedWith()

getSharedWith(string  $userId, integer  $shareType, \OCP\Files\Node|null  $node = null, integer  $limit = 50, integer  $offset) : array<mixed,\OCP\Share\IShare>

Get shares shared with $user.

Filter by $node if provided

Parameters

string $userId
integer $shareType
\OCP\Files\Node|null $node
integer $limit

The maximum number of shares returned, -1 for all

integer $offset

Returns

array<mixed,\OCP\Share\IShare>

getShareById()

getShareById(string  $id, string|null  $recipient = null) : \OCP\Share\IShare

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.

Parameters

string $id
string|null $recipient

userID of the recipient

Throws

\OCP\Share\Exceptions\ShareNotFound

Returns

\OCP\Share\IShare

getShareByToken()

getShareByToken(string  $token) : \OCP\Share\IShare

Get the share by token possible with password

Parameters

string $token

Throws

\OCP\Share\Exceptions\ShareNotFound

Returns

\OCP\Share\IShare

checkPassword()

checkPassword(\OCP\Share\IShare  $share, string  $password) : boolean

Verify the password of a public share

Parameters

\OCP\Share\IShare $share
string $password

Returns

boolean

userDeleted()

userDeleted(string  $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.

Parameters

string $uid

groupDeleted()

groupDeleted(string  $gid) 

The group with $gid is deleted We need to clear up all shares to this group

Parameters

string $gid

userDeletedFromGroup()

userDeletedFromGroup(string  $uid, string  $gid) 

The user $uid is deleted from the group $gid All user specific group shares have to be removed

Parameters

string $uid
string $gid

newShare()

newShare() : \OCP\Share\IShare

Instantiates a new share object. This is to be passed to createShare.

Returns

\OCP\Share\IShare

shareApiEnabled()

shareApiEnabled() : boolean

Is the share API enabled

Returns

boolean

shareApiAllowLinks()

shareApiAllowLinks() : boolean

Is public link sharing enabled

Returns

boolean

shareApiLinkEnforcePassword()

shareApiLinkEnforcePassword() : boolean

Is password on public link requires

Returns

boolean

shareApiLinkDefaultExpireDate()

shareApiLinkDefaultExpireDate() : boolean

Is default expire date enabled

Returns

boolean

shareApiLinkDefaultExpireDateEnforced()

shareApiLinkDefaultExpireDateEnforced() : boolean

Is default expire date enforced `

Returns

boolean

shareApiLinkDefaultExpireDays()

shareApiLinkDefaultExpireDays() : integer

Number of default expire days

Returns

integer

shareApiLinkAllowPublicUpload()

shareApiLinkAllowPublicUpload() : boolean

Allow public upload on link shares

Returns

boolean

shareWithGroupMembersOnly()

shareWithGroupMembersOnly() : boolean

check if user can only share with group members

Returns

boolean

allowGroupSharing()

allowGroupSharing() : boolean

Check if users can share with groups

Returns

boolean

sharingDisabledForUser()

sharingDisabledForUser(string  $userId) : boolean

Check if sharing is disabled for the given user

Parameters

string $userId

Returns

boolean

outgoingServer2ServerSharesAllowed()

outgoingServer2ServerSharesAllowed() : boolean

Check if outgoing server2server shares are allowed

Returns

boolean