Nextcloud PHP API (master)

IShareProvider

Interface IShareProvider

Tags
since
9.0.0

Table of Contents

Methods

create()  : IShare
Create a share
delete()  : mixed
Delete a share
deleteFromSelf()  : mixed
Unshare a file from self as recipient.
getAccessList()  : array<string|int, mixed>
Get the access list to the array of provided nodes.
getAllShares()  : iterable<string|int, mixed>
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()  : array<string|int, IShare>
Get shared with the given user
getSharesBy()  : array<string|int, IShare>
Get all shares by the given user
getSharesByPath()  : array<string|int, IShare>
Get shares for a given path
getSharesInFolder()  : array<string|int, array<string|int, 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

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

getAccessList()

Get the access list to the array of provided nodes.

public getAccessList(array<string|int, Node$nodes, bool $currentAccess) : array<string|int, mixed>
Parameters
$nodes : array<string|int, 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<string|int, mixed>

getAllShares()

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

public getAllShares() : iterable<string|int, mixed>
Tags
since
18.0.0
Return values
iterable<string|int, mixed>

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) : array<string|int, 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
array<string|int, IShare>

getSharesBy()

Get all shares by the given user

public getSharesBy(string $userId, int $shareType, Node|null $node, bool $reshares, int $limit, int $offset) : array<string|int, 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
array<string|int, IShare>

getSharesByPath()

Get shares for a given path

public getSharesByPath(Node $path) : array<string|int, IShare>
Parameters
$path : Node
Tags
since
9.0.0
Return values
array<string|int, IShare>

getSharesInFolder()

Get all shares by the given user in a folder

public getSharesInFolder(string $userId, Folder $node, bool $reshares[, bool $shallow = true ]) : array<string|int, array<string|int, 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

$shallow : bool = true

Whether the method should stop at the first level, or look into sub-folders.

Tags
since
11.0.0
Return values
array<string|int, array<string|int, 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

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

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

        
On this page

Search results