ISystemTagManager
Public interface to access and manage system-wide tags.
Tags
Table of Contents
- canUserAssignTag() : true
- Checks whether the given user is allowed to assign/unassign the tag with the given id.
- canUserSeeTag() : true
- Checks whether the given user is allowed to see the tag with the given id.
- createTag() : ISystemTag
- Creates the tag object using the given attributes.
- deleteTags() : mixed
- Delete the given tags from the database and all their relationships.
- getAllTags() : \OCP\SystemTag\ISystemTag[]
- Returns all known tags, optionally filtered by visibility.
- getTag() : ISystemTag
- Returns the tag object matching the given attributes.
- getTagGroups() : string[]
- Get groups that can assign a given tag.
- getTagsByIds() : \OCP\SystemTag\ISystemTag[]
- Returns the tag objects matching the given tag ids.
- setTagGroups() : mixed
- Set groups that can assign a given tag.
- updateTag() : mixed
- Updates the given tag
Methods
canUserAssignTag()
Checks whether the given user is allowed to assign/unassign the tag with the given id.
public
canUserAssignTag(ISystemTag $tag, IUser $user) : true
Parameters
- $tag : ISystemTag
-
tag to check permission for
- $user : IUser
-
user to check permission for
Tags
Return values
true —if the user is allowed to assign/unassign the tag, false otherwise
canUserSeeTag()
Checks whether the given user is allowed to see the tag with the given id.
public
canUserSeeTag(ISystemTag $tag, IUser $user) : true
Parameters
- $tag : ISystemTag
-
tag to check permission for
- $user : IUser
-
user to check permission for
Tags
Return values
true —if the user can see the tag, false otherwise
createTag()
Creates the tag object using the given attributes.
public
createTag(string $tagName, bool $userVisible, bool $userAssignable) : ISystemTag
Parameters
- $tagName : string
-
tag name
- $userVisible : bool
-
whether the tag is visible by users
- $userAssignable : bool
-
whether the tag is assignable by users
Tags
Return values
ISystemTag —system tag
deleteTags()
Delete the given tags from the database and all their relationships.
public
deleteTags(string|array $tagIds) : mixed
Parameters
- $tagIds : string|array
-
array of tag ids
Tags
Return values
mixed —getAllTags()
Returns all known tags, optionally filtered by visibility.
public
getAllTags([bool|null $visibilityFilter = null ][, string $nameSearchPattern = null ]) : \OCP\SystemTag\ISystemTag[]
Parameters
- $visibilityFilter : bool|null = null
-
filter by visibility if non-null
- $nameSearchPattern : string = null
-
optional search pattern for the tag name
Tags
Return values
\OCP\SystemTag\ISystemTag[] —array of system tags or empty array if none found
getTag()
Returns the tag object matching the given attributes.
public
getTag(string $tagName, bool $userVisible, bool $userAssignable) : ISystemTag
Parameters
- $tagName : string
-
tag name
- $userVisible : bool
-
whether the tag is visible by users
- $userAssignable : bool
-
whether the tag is assignable by users
Tags
Return values
ISystemTag —system tag
getTagGroups()
Get groups that can assign a given tag.
public
getTagGroups(ISystemTag $tag) : string[]
Parameters
- $tag : ISystemTag
-
tag for group assignment
Tags
Return values
string[] —group ids of groups that can assign/unassign the tag
getTagsByIds()
Returns the tag objects matching the given tag ids.
public
getTagsByIds(array|string $tagIds) : \OCP\SystemTag\ISystemTag[]
Parameters
- $tagIds : array|string
-
id or array of unique ids of the tag to retrieve
Tags
Return values
\OCP\SystemTag\ISystemTag[] —array of system tags with tag id as key
setTagGroups()
Set groups that can assign a given tag.
public
setTagGroups(ISystemTag $tag, string[] $groupIds) : mixed
Parameters
- $tag : ISystemTag
-
tag for group assignment
- $groupIds : string[]
-
group ids of groups that can assign/unassign the tag
Tags
Return values
mixed —updateTag()
Updates the given tag
public
updateTag(string $tagId, string $newName, bool $userVisible, bool $userAssignable) : mixed
Parameters
- $tagId : string
-
tag id
- $newName : string
-
the new tag name
- $userVisible : bool
-
whether the tag is visible by users
- $userAssignable : bool
-
whether the tag is assignable by users