Nextcloud PHP API (master)

Share_Backend_File_Dependent extends Share_Backend

Interface for share backends that share content that is dependent on files.

Extends the Share_Backend interface.

Tags
since
5.0.0

Table of Contents

Methods

formatItems()  : array<string|int, mixed>
Converts the shared item sources back into the item in the specified format
generateTarget()  : string
Get a unique name of the item for the specified user
getFilePath()  : string|false
Get the file path of the item
isShareTypeAllowed()  : bool
Check if a given share type is allowed by the back-end
isValidSource()  : bool|null
Check if this $itemSource exist for the user

Methods

formatItems()

Converts the shared item sources back into the item in the specified format

public formatItems(array<string|int, mixed> $items, int $format[, mixed $parameters = null ]) : array<string|int, mixed>
Parameters
$items : array<string|int, mixed>

Shared items

$format : int
$parameters : mixed = null
Tags
since
5.0.0
Return values
array<string|int, mixed>

The items array is a 3-dimensional array with the item_source as the first key and the share id as the second key to an array with the share info.

The key/value pairs included in the share info depend on the function originally called: If called by getItem(s)Shared: id, item_type, item, item_source, share_type, share_with, permissions, stime, file_source

If called by getItem(s)SharedWith: id, item_type, item, item_source, item_target, share_type, share_with, permissions, stime, file_source, file_target

This function allows the backend to control the output of shared items with custom formats. It is only called through calls to the public getItem(s)Shared(With) functions.

generateTarget()

Get a unique name of the item for the specified user

public generateTarget(string $itemSource, string|false $shareWith) : string
Parameters
$itemSource : string
$shareWith : string|false

User the item is being shared with

Tags
since
5.0.0
Return values
string

Target name

This function needs to verify that the user does not already have an item with this name. If it does generate a new name e.g. name_#

getFilePath()

Get the file path of the item

public getFilePath(string $itemSource, string $uidOwner) : string|false
Parameters
$itemSource : string
$uidOwner : string

User that is the owner of shared item

Tags
since
5.0.0
Return values
string|false

isShareTypeAllowed()

Check if a given share type is allowed by the back-end

public isShareTypeAllowed(int $shareType) : bool
Parameters
$shareType : int

share type

Tags
since
8.0.0
Return values
bool

The back-end can enable/disable specific share types. Just return true if the back-end doesn't provide any specific settings for it and want to allow all share types defined by the share API

isValidSource()

Check if this $itemSource exist for the user

public isValidSource(string $itemSource, string $uidOwner) : bool|null
Parameters
$itemSource : string
$uidOwner : string

Owner of the item

Tags
since
5.0.0
Return values
bool|null

Source

Return false if the item does not exist for the user


        
On this page

Search results