summaryrefslogtreecommitdiff
path: root/classes/Profile_role.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-03-05 03:56:04 +0000
committerZach Copley <zach@status.net>2010-03-05 03:56:04 +0000
commitb8001ea1079c4c8895fd2323e1e4a47c0d71fde3 (patch)
treeb732b239bf790c78c90f4c7d3be7044ce9f7da45 /classes/Profile_role.php
parente3c4b0c85d3fbae9604b22d3666fe36a3c1c7551 (diff)
parent064c45890f896f2af8a0231449fa5337bb79c509 (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'classes/Profile_role.php')
-rw-r--r--classes/Profile_role.php17
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);
+ }
}