]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile_role.php
fix attributes on homepage output
[quix0rs-gnu-social.git] / classes / Profile_role.php
index bf2c453ed0bf719f9cc00d5ff679c5cac1f6d708..e7aa1f0f0675b45bb07145c1831fe6a18e2fd31b 100644 (file)
@@ -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);
+    }
 }