diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-04-27 13:47:04 +0300 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-05-20 18:56:02 +0300 |
commit | 8343cfb64b8297035987bc4980ec72015c8e1a04 (patch) | |
tree | 812f44ba113313e7537779bcce4c04cf736e4cad /lib/public/SystemTag | |
parent | 59a85a4c76b80658d9373e3acf4f71b872b244a0 (diff) |
Add interface methods for permission check
Instead of checking for admin perm, use interface method
canUserAssignTag and canUserSeeTag to check for permissions.
Allows for more flexible implementation.
Diffstat (limited to 'lib/public/SystemTag')
-rw-r--r-- | lib/public/SystemTag/ISystemTagManager.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/public/SystemTag/ISystemTagManager.php b/lib/public/SystemTag/ISystemTagManager.php index 983bfd636ce..7fb0c21436c 100644 --- a/lib/public/SystemTag/ISystemTagManager.php +++ b/lib/public/SystemTag/ISystemTagManager.php @@ -113,4 +113,37 @@ interface ISystemTagManager { */ public function deleteTags($tagIds); + /** + * Checks whether the given user is allowed to assign/unassign the tag with the + * given id. + * + * @param string|\OCP\SystemTag\ISystemTag $tag tag id or system tag + * @param string $userId user id + * + * @return true if the user is allowed to assign/unassign the tag, false otherwise + * + * @throws \OCP\SystemTag\TagNotFoundException if tag with the given id does not exist + * @throws \OCP\UserNotFoundException if the given user id does not exist + * @throws \InvalidArgumentException if the tag id is invalid (string instead of integer, etc.) + * + * @since 9.1.0 + */ + public function canUserAssignTag($tag, $userId); + + /** + * Checks whether the given user is allowed to see the tag with the given id. + * + * @param string|\OCP\SystemTag\ISystemTag $tag tag id or system tag + * @param string $userId user id + * + * @return true if the user is allowed to assign/unassign the tag, false otherwise + * + * @throws \OCP\SystemTag\TagNotFoundException if tag with the given id does not exist + * @throws \OCP\UserNotFoundException if the given user id does not exist + * @throws \InvalidArgumentException if the tag id is invalid (string instead of integer, etc.) + * + * @since 9.1.0 + */ + public function canUserSeeTag($tag, $userId); + } |