Nextcloud PHP API (stable18)

IManager

Interface IManager

Tags
since
9.0.0

Table of Contents

acceptShare()  : IShare
Accept a share.
allowGroupSharing()  : bool
Check if users can share with groups
checkPassword()  : bool
Verify the password of a public share
createShare()  : IShare
Create a Share
deleteFromSelf()  : mixed
Unshare a file as the recipient.
deleteShare()  : mixed
Delete a share
getAccessList()  : array
Get access list to a path. This means all the users that can access a given path.
getAllShares()  : iterable
getDeletedSharedWith()  : \OCP\Share\IShare[]
Get deleted shares shared with $user.
getShareById()  : IShare
Retrieve a share by the share id.
getShareByToken()  : IShare
Get the share by token possible with password
getSharedWith()  : \OCP\Share\IShare[]
Get shares shared with $user.
getSharesBy()  : \OCP\Share\IShare[]
Get shares shared by (initiated) by the provided user.
getSharesInFolder()  : \OCP\Share\IShare[][]
Get all shares shared by (initiated) by the provided user in a folder.
groupDeleted()  : mixed
The group with $gid is deleted We need to clear up all shares to this group
moveShare()  : IShare
Move the share as a recipient of the share.
newShare()  : IShare
Instantiates a new share object. This is to be passed to createShare.
outgoingServer2ServerGroupSharesAllowed()  : bool
Check if outgoing server2server shares are allowed
outgoingServer2ServerSharesAllowed()  : bool
Check if outgoing server2server shares are allowed
restoreShare()  : IShare
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\
shareApiAllowLinks()  : bool
Is public link sharing enabled
shareApiEnabled()  : bool
Is the share API enabled
shareApiLinkAllowPublicUpload()  : bool
Allow public upload on link shares
shareApiLinkDefaultExpireDate()  : bool
Is default expire date enabled
shareApiLinkDefaultExpireDateEnforced()  : bool
Is default expire date enforced `
shareApiLinkDefaultExpireDays()  : int
Number of default expire days
shareApiLinkEnforcePassword()  : bool
Is password on public link requires
shareProviderExists()  : bool
Check if a given share provider exists
shareWithGroupMembersOnly()  : bool
check if user can only share with group members
sharingDisabledForUser()  : bool
Check if sharing is disabled for the given user
updateShare()  : IShare
Update a share.
userDeleted()  : mixed
The user with UID is deleted.
userDeletedFromGroup()  : mixed
The user $uid is deleted from the group $gid All user specific group shares have to be removed

Methods

acceptShare()

Accept a share.

public acceptShare(IShare $share, string $recipientId) : IShare
Parameters
$share : IShare
$recipientId : string
Tags
throws
InvalidArgumentException
since
18.0.0
Return values
IShare

The share object

allowGroupSharing()

Check if users can share with groups

public allowGroupSharing() : bool
Tags
since
9.0.1
Return values
bool

checkPassword()

Verify the password of a public share

public checkPassword(IShare $share, string $password) : bool
Parameters
$share : IShare
$password : string
Tags
since
9.0.0
Return values
bool

createShare()

Create a Share

public createShare(IShare $share) : IShare
Parameters
$share : IShare
Tags
throws
Exception
since
9.0.0
Return values
IShare

The share object

deleteFromSelf()

Unshare a file as the recipient.

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

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
$share : IShare
$recipientId : string
Tags
since
9.0.0
Return values
mixed

deleteShare()

Delete a share

public deleteShare(IShare $share) : mixed
Parameters
$share : IShare
Tags
throws
ShareNotFound
throws
InvalidArgumentException
since
9.0.0
Return values
mixed

getAccessList()

Get access list to a path. This means all the users that can access a given path.

public getAccessList(Node $path[, bool $recursive = true ][, bool $currentAccess = false ]) : array

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

Parameters
$path : Node
$recursive : bool = true

Should we check all parent folders as well

$currentAccess : bool = false

Should the user have currently access to the file

Tags
since
12
Return values
array

getAllShares()

public getAllShares() : iterable
Tags
Internal

Get all the shares as iterable to reduce memory overhead Note, since this opens up database cursors the iterable should be fully itterated.

since
18.0.0
Return values
iterable

getDeletedSharedWith()

Get deleted shares shared with $user.

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

Filter by $node if provided

Parameters
$userId : string
$shareType : int
$node : Node|null = null
$limit : int = 50

The maximum number of shares returned, -1 for all

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

getShareById()

Retrieve a share by the share id.

public getShareById(string $id[, string|null $recipient = null ]) : IShare

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
$id : string
$recipient : string|null = null

userID of the recipient

Tags
throws
ShareNotFound
since
9.0.0
Return values
IShare

getShareByToken()

Get the share by token possible with password

public getShareByToken(string $token) : IShare
Parameters
$token : string
Tags
throws
ShareNotFound
since
9.0.0
Return values
IShare

getSharedWith()

Get shares shared with $user.

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

Filter by $node if provided

Parameters
$userId : string
$shareType : int
$node : Node|null = null
$limit : int = 50

The maximum number of shares returned, -1 for all

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

getSharesBy()

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

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

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

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

getSharesInFolder()

Get all shares shared by (initiated) by the provided user in a folder.

public getSharesInFolder(string $userId, Folder $node[, bool $reshares = false ]) : \OCP\Share\IShare[][]
Parameters
$userId : string
$node : Folder
$reshares : bool = false
Tags
since
11.0.0
Return values
\OCP\Share\IShare[][]

[$fileId => IShare[], ...]

groupDeleted()

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

public groupDeleted(string $gid) : mixed
Parameters
$gid : string
Tags
since
9.1.0
Return values
mixed

moveShare()

Move the share as a recipient of the share.

public moveShare(IShare $share, string $recipientId) : IShare

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

Parameters
$share : IShare
$recipientId : string
Tags
throws
InvalidArgumentException

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

since
9.0.0
Return values
IShare

newShare()

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

public newShare() : IShare
Tags
since
9.0.0
Return values
IShare

outgoingServer2ServerGroupSharesAllowed()

Check if outgoing server2server shares are allowed

public outgoingServer2ServerGroupSharesAllowed() : bool
Tags
since
14.0.0
Return values
bool

outgoingServer2ServerSharesAllowed()

Check if outgoing server2server shares are allowed

public outgoingServer2ServerSharesAllowed() : bool
Tags
since
9.0.0
Return values
bool

restoreShare()

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\

public restoreShare(IShare $share, string $recipientId) : IShare
Parameters
$share : IShare

The share to restore

$recipientId : string

The user to restore the share for

Tags
throws
GenericShareException

In case restoring the share failed

since
14.0.0
Return values
IShare

The restored share object

Is public link sharing enabled

public shareApiAllowLinks() : bool
Tags
since
9.0.0
Return values
bool

shareApiEnabled()

Is the share API enabled

public shareApiEnabled() : bool
Tags
since
9.0.0
Return values
bool

shareApiLinkAllowPublicUpload()

Allow public upload on link shares

public shareApiLinkAllowPublicUpload() : bool
Tags
since
9.0.0
Return values
bool

shareApiLinkDefaultExpireDate()

Is default expire date enabled

public shareApiLinkDefaultExpireDate() : bool
Tags
since
9.0.0
Return values
bool

shareApiLinkDefaultExpireDateEnforced()

Is default expire date enforced `

public shareApiLinkDefaultExpireDateEnforced() : bool
Tags
since
9.0.0
Return values
bool

shareApiLinkDefaultExpireDays()

Number of default expire days

public shareApiLinkDefaultExpireDays() : int
Tags
since
9.0.0
Return values
int

shareApiLinkEnforcePassword()

Is password on public link requires

public shareApiLinkEnforcePassword() : bool
Tags
since
9.0.0
Return values
bool

shareProviderExists()

Check if a given share provider exists

public shareProviderExists(int $shareType) : bool
Parameters
$shareType : int
Tags
since
11.0.0
Return values
bool

shareWithGroupMembersOnly()

check if user can only share with group members

public shareWithGroupMembersOnly() : bool
Tags
since
9.0.0
Return values
bool

sharingDisabledForUser()

Check if sharing is disabled for the given user

public sharingDisabledForUser(string $userId) : bool
Parameters
$userId : string
Tags
since
9.0.0
Return values
bool

updateShare()

Update a share.

public updateShare(IShare $share) : IShare

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

Parameters
$share : IShare
Tags
throws
InvalidArgumentException
since
9.0.0
Return values
IShare

The share object

userDeleted()

The user with UID is deleted.

public userDeleted(string $uid) : mixed

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
$uid : string
Tags
since
9.1.0
Return values
mixed

userDeletedFromGroup()

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

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

Search results