Nextcloud PHP API (stable18)

IShareProvider

Interface IShareProvider

Tags
since
9.0.0

Table of Contents

create()  : IShare
Create a share
delete()  : mixed
Delete a share
deleteFromSelf()  : mixed
Unshare a file from self as recipient.
getAccessList()  : array
Get the access list to the array of provided nodes.
getAllShares()  : iterable
Get all the shares in this provider returned as iterable to reduce memory overhead
getShareById()  : IShare
Get share by id
getShareByToken()  : IShare
Get a share by token
getSharedWith()  : \OCP\Share\IShare[]
Get shared with the given user
getSharesBy()  : \OCP\Share\IShare[]
Get all shares by the given user
getSharesByPath()  : \OCP\Share\IShare[]
Get shares for a given path
getSharesInFolder()  : \OCP\Share\IShare[]
Get all shares by the given user in a folder
groupDeleted()  : mixed
A group is deleted from the system.
identifier()  : string
Return the identifier of this provider.
move()  : IShare
Move a share as a recipient.
restore()  : IShare
Restore a share for a given recipient. The implementation could be provider independant.
update()  : IShare
Update a share
userDeleted()  : mixed
A user is deleted from the system So clean up the relevant shares.
userDeletedFromGroup()  : mixed
A user is deleted from a group We have to clean up all the related user specific group shares Providers not handling group shares should just return

Methods

delete()

Delete a share

public delete(IShare $share) : mixed
Parameters
$share : IShare
Tags
since
9.0.0
Return values
mixed

deleteFromSelf()

Unshare a file from self as recipient.

public deleteFromSelf(IShare $share, string $recipient) : mixed

This may require special handling. If a user unshares a group share from their self then the original group share should still exist.

Parameters
$share : IShare
$recipient : string

UserId of the recipient

Tags
since
9.0.0
Return values
mixed

getAccessList()

Get the access list to the array of provided nodes.

public getAccessList(\OCP\Files\Node[] $nodes, bool $currentAccess) : array
Parameters
$nodes : \OCP\Files\Node[]

The list of nodes to get access for

$currentAccess : bool

If current access is required (like for removed shares that might get revived later)

Tags
see
IManager::getAccessList()

for sample docs

since
12
Return values
array

getAllShares()

Get all the shares in this provider returned as iterable to reduce memory overhead

public getAllShares() : iterable
Tags
since
18.0.0
Return values
iterable

getShareById()

Get share by id

public getShareById(int $id[, string|null $recipientId = null ]) : IShare
Parameters
$id : int
$recipientId : string|null = null
Tags
throws
ShareNotFound
since
9.0.0
Return values
IShare

getSharedWith()

Get shared with the given user

public getSharedWith(string $userId, int $shareType, Node|null $node, int $limit, int $offset) : \OCP\Share\IShare[]
Parameters
$userId : string

get shares where this user is the recipient

$shareType : int
$node : Node|null
$limit : int

The max number of entries returned, -1 for all

$offset : int
Tags
since
9.0.0
Return values
\OCP\Share\IShare[]

getSharesBy()

Get all shares by the given user

public getSharesBy(string $userId, int $shareType, Node|null $node, bool $reshares, int $limit, int $offset) : \OCP\Share\IShare[]
Parameters
$userId : string
$shareType : int
$node : Node|null
$reshares : bool

Also get the shares where $user is the owner instead of just the shares where $user is the initiator

$limit : int

The maximum number of shares to be returned, -1 for all shares

$offset : int
Tags
since
9.0.0
Return values
\OCP\Share\IShare[]

getSharesByPath()

Get shares for a given path

public getSharesByPath(Node $path) : \OCP\Share\IShare[]
Parameters
$path : Node
Tags
since
9.0.0
Return values
\OCP\Share\IShare[]

getSharesInFolder()

Get all shares by the given user in a folder

public getSharesInFolder(string $userId, Folder $node, bool $reshares) : \OCP\Share\IShare[]
Parameters
$userId : string
$node : Folder
$reshares : bool

Also get the shares where $user is the owner instead of just the shares where $user is the initiator

Tags
since
11.0.0
Return values
\OCP\Share\IShare[]

groupDeleted()

A group is deleted from the system.

public groupDeleted(string $gid) : mixed

We have to clean up all shares to this group. Providers not handling group shares should just return

Parameters
$gid : string
Tags
since
9.1.0
Return values
mixed

identifier()

Return the identifier of this provider.

public identifier() : string
Tags
since
9.0.0
Return values
string

Containing only [a-zA-Z0-9]

move()

Move a share as a recipient.

public move(IShare $share, string $recipient) : IShare

This is updating the share target. Thus the mount point of the recipient. This may require special handling. If a user moves a group share the target should only be changed for them.

Parameters
$share : IShare
$recipient : string

userId of recipient

Tags
since
9.0.0
Return values
IShare

restore()

Restore a share for a given recipient. The implementation could be provider independant.

public restore(IShare $share, string $recipient) : IShare
Parameters
$share : IShare
$recipient : string
Tags
since
14.0.0
throws
GenericShareException

In case the share could not be restored

Return values
IShare

The restored share object

userDeleted()

A user is deleted from the system So clean up the relevant shares.

public userDeleted(string $uid, int $shareType) : mixed
Parameters
$uid : string
$shareType : int
Tags
since
9.1.0
Return values
mixed

userDeletedFromGroup()

A user is deleted from a group We have to clean up all the related user specific group shares Providers not handling group shares should just return

public userDeletedFromGroup(string $uid, string $gid) : mixed
Parameters
$uid : string
$gid : string
Tags
since
9.1.0
Return values
mixed

Search results