diff options
author | Brion Vibber <brion@pobox.com> | 2010-03-04 06:07:28 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-03-04 06:07:28 -0800 |
commit | b218aee94e581230e1efa14d4ae1a19756986ddf (patch) | |
tree | a832ddf3b4322b520fd20c4d8ea2d31720c3679b /classes/Profile_role.php | |
parent | 358556057a87c0cb9291223a2026782e6548ff2e (diff) | |
parent | 14d7f4a598d0e24467fe3eafd9a02b0e651edad8 (diff) |
Merge commit 'origin/testing' into 0.9.x
Conflicts:
lib/action.php
lib/adminpanelaction.php
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); + } } |