From: Jan Schneider Date: Fri, 28 Jan 2011 14:39:54 +0000 (+0100) Subject: Add shortcut methods for adding and removing default, guest, and creator permissions. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6053160b382f28986d7147102b951c965043b3cb;p=horde.git Add shortcut methods for adding and removing default, guest, and creator permissions. --- diff --git a/framework/Share/lib/Horde/Share/Object.php b/framework/Share/lib/Horde/Share/Object.php index 9c100cff8..08452bb01 100644 --- a/framework/Share/lib/Horde/Share/Object.php +++ b/framework/Share/lib/Horde/Share/Object.php @@ -229,6 +229,78 @@ abstract class Horde_Share_Object implements Serializable } /** + * Gives guests a certain privilege for this share. + * + * @param integer $permission A Horde_Perms::* constant. + */ + public function addGuestPermission($permission) + { + $perm = $this->getPermission(); + $perm->addGuestPermission($permission, false); + $this->setPermission($perm); + } + + /** + * Removes a certain privilege for guests from this share. + * + * @param integer $permission A Horde_Perms::* constant. + */ + public function removeGuestPermission($permission) + { + $perm = $this->getPermission(); + $perm->removeGuestPermission($permission, false); + $this->setPermission($perm); + } + + /** + * Gives creators a certain privilege for this share. + * + * @param integer $permission A Horde_Perms::* constant. + */ + public function addCreatorPermission($permission) + { + $perm = $this->getPermission(); + $perm->addCreatorPermission($permission, false); + $this->setPermission($perm); + } + + /** + * Removes a certain privilege for creators from this share. + * + * @param integer $permission A Horde_Perms::* constant. + */ + public function removeCreatorPermission($permission) + { + $perm = $this->getPermission(); + $perm->removeCreatorPermission($permission, false); + $this->setPermission($perm); + } + + /** + * Gives all authenticated users a certain privilege for this share. + * + * @param integer $permission A Horde_Perms::* constant. + */ + public function addDefaultPermission($permission) + { + $perm = $this->getPermission(); + $perm->addDefaultPermission($permission, false); + $this->setPermission($perm); + } + + /** + * Removes a certain privilege for all authenticated users from this share. + * + * @param integer $permission A Horde_Perms::* constant. + */ + public function removeDefaultPermission($permission) + { + $perm = $this->getPermission(); + $perm->removeDefaultPermission($permission, false); + $this->setPermission($perm); + } + + /** * Checks to see if a user has a given permission. * * @param string $userid The userid of the user.