\OCP\SystemTagISystemTagManager

Public interface to access and manage system-wide tags.

Summary

Methods
Constants
getTagsByIds()
getTag()
createTag()
getAllTags()
updateTag()
deleteTags()
canUserAssignTag()
canUserSeeTag()
setTagGroups()
getTagGroups()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

getTagsByIds()

getTagsByIds(array|string  $tagIds) : array<mixed,\OCP\SystemTag\ISystemTag>

Returns the tag objects matching the given tag ids.

Parameters

array|string $tagIds

id or array of unique ids of the tag to retrieve

Throws

\InvalidArgumentException

if at least one given tag ids is invalid (string instead of integer, etc.)

\OCP\SystemTag\TagNotFoundException

if at least one given tag ids did no exist The message contains a json_encoded array of the ids that could not be found

Returns

array<mixed,\OCP\SystemTag\ISystemTag> —

array of system tags with tag id as key

getTag()

getTag(string  $tagName, boolean  $userVisible, boolean  $userAssignable) : \OCP\SystemTag\ISystemTag

Returns the tag object matching the given attributes.

Parameters

string $tagName

tag name

boolean $userVisible

whether the tag is visible by users

boolean $userAssignable

whether the tag is assignable by users

Throws

\OCP\SystemTag\TagNotFoundException

if tag does not exist

Returns

\OCP\SystemTag\ISystemTag

system tag

createTag()

createTag(string  $tagName, boolean  $userVisible, boolean  $userAssignable) : \OCP\SystemTag\ISystemTag

Creates the tag object using the given attributes.

Parameters

string $tagName

tag name

boolean $userVisible

whether the tag is visible by users

boolean $userAssignable

whether the tag is assignable by users

Throws

\OCP\SystemTag\TagAlreadyExistsException

if tag already exists

Returns

\OCP\SystemTag\ISystemTag

system tag

getAllTags()

getAllTags(boolean|null  $visibilityFilter = null, string  $nameSearchPattern = null) : array<mixed,\OCP\SystemTag\ISystemTag>

Returns all known tags, optionally filtered by visibility.

Parameters

boolean|null $visibilityFilter

filter by visibility if non-null

string $nameSearchPattern

optional search pattern for the tag name

Returns

array<mixed,\OCP\SystemTag\ISystemTag> —

array of system tags or empty array if none found

updateTag()

updateTag(string  $tagId, string  $newName, boolean  $userVisible, boolean  $userAssignable) 

Updates the given tag

Parameters

string $tagId

tag id

string $newName

the new tag name

boolean $userVisible

whether the tag is visible by users

boolean $userAssignable

whether the tag is assignable by users

Throws

\OCP\SystemTag\TagNotFoundException

if tag with the given id does not exist

\OCP\SystemTag\TagAlreadyExistsException

if there is already another tag with the same attributes

deleteTags()

deleteTags(string|array  $tagIds) 

Delete the given tags from the database and all their relationships.

Parameters

string|array $tagIds

array of tag ids

Throws

\OCP\SystemTag\TagNotFoundException

if at least one tag did not exist

canUserAssignTag()

canUserAssignTag(\OCP\SystemTag\ISystemTag  $tag, \OCP\IUser  $user) : true

Checks whether the given user is allowed to assign/unassign the tag with the given id.

Parameters

\OCP\SystemTag\ISystemTag $tag

tag to check permission for

\OCP\IUser $user

user to check permission for

Returns

true —

if the user is allowed to assign/unassign the tag, false otherwise

canUserSeeTag()

canUserSeeTag(\OCP\SystemTag\ISystemTag  $tag, \OCP\IUser  $userId) : true

Checks whether the given user is allowed to see the tag with the given id.

Parameters

\OCP\SystemTag\ISystemTag $tag

tag to check permission for

\OCP\IUser $userId

Returns

true —

if the user can see the tag, false otherwise

setTagGroups()

setTagGroups(\OCP\SystemTag\ISystemTag  $tag, array<mixed,string>  $groupIds) 

Set groups that can assign a given tag.

Parameters

\OCP\SystemTag\ISystemTag $tag

tag for group assignment

array<mixed,string> $groupIds

group ids of groups that can assign/unassign the tag

getTagGroups()

getTagGroups(\OCP\SystemTag\ISystemTag  $tag) : array<mixed,string>

Get groups that can assign a given tag.

Parameters

\OCP\SystemTag\ISystemTag $tag

tag for group assignment

Returns

array<mixed,string> —

group ids of groups that can assign/unassign the tag