X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FProfile_role.php;h=e7aa1f0f0675b45bb07145c1831fe6a18e2fd31b;hb=edea825c70c2adb550e4fb47a94c497e0e92f0ad;hp=bf2c453ed0bf719f9cc00d5ff679c5cac1f6d708;hpb=7ebd13fa69d2a5dac8bc59799281d3d6e017eeae;p=quix0rs-gnu-social.git diff --git a/classes/Profile_role.php b/classes/Profile_role.php index bf2c453ed0..e7aa1f0f06 100644 --- a/classes/Profile_role.php +++ b/classes/Profile_role.php @@ -53,4 +53,22 @@ class Profile_role extends Memcached_DataObject const ADMINISTRATOR = 'administrator'; const SANDBOXED = 'sandboxed'; const SILENCED = 'silenced'; + const DELETED = 'deleted'; // Pending final deletion of notices... + + 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); + } }