diff options
author | Brion Vibber <brion@pobox.com> | 2010-03-03 15:43:49 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-03-03 15:43:49 -0800 |
commit | 4a2511139eaafcbe93a2e720e0c6f170ecb00d77 (patch) | |
tree | 1b9abf6fcd9db6a4d785871352dd7eb20ae35b82 /classes/Profile_role.php | |
parent | 06db00d303bda500eec578b490c12d2bf389c853 (diff) |
Initial user role controls on profile pages, for owner to add/remove administrator and moderator options.
Buttons need to be themed.
Diffstat (limited to 'classes/Profile_role.php')
-rw-r--r-- | classes/Profile_role.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/classes/Profile_role.php b/classes/Profile_role.php index bf2c453ed..d0a0b31f0 100644 --- a/classes/Profile_role.php +++ b/classes/Profile_role.php @@ -53,4 +53,21 @@ class Profile_role extends Memcached_DataObject const ADMINISTRATOR = 'administrator'; const SANDBOXED = 'sandboxed'; const SILENCED = 'silenced'; + + public static function isValid($role) + { + // @fixme could probably pull this from class constants + $known = array(self::OWNER, + self::MODERATOR, + self::ADMINISTRATOR, + self::SANDBOXED, + self::SILENCED); + return in_array($role, $known); + } + + public static function isSettable($role) + { + $allowedRoles = array('administrator', 'moderator'); + return self::isValid($role) && in_array($role, $allowedRoles); + } } |