summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/Notice.php8
-rw-r--r--classes/Profile.php4
-rw-r--r--classes/Profile_role.php17
3 files changed, 26 insertions, 3 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 97cb3b8fb..4c7e6ab4b 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -1106,7 +1106,7 @@ class Notice extends Memcached_DataObject
return $groups;
}
- function asAtomEntry($namespace=false, $source=false)
+ function asAtomEntry($namespace=false, $source=false, $author=true)
{
$profile = $this->getProfile();
@@ -1151,8 +1151,10 @@ class Notice extends Memcached_DataObject
$xs->element('title', null, $this->content);
- $xs->raw($profile->asAtomAuthor());
- $xs->raw($profile->asActivityActor());
+ if ($author) {
+ $xs->raw($profile->asAtomAuthor());
+ $xs->raw($profile->asActivityActor());
+ }
$xs->element('link', array('rel' => 'alternate',
'type' => 'text/html',
diff --git a/classes/Profile.php b/classes/Profile.php
index 9c2fa7a0c..0322c9358 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -743,6 +743,10 @@ class Profile extends Memcached_DataObject
case Right::CONFIGURESITE:
$result = $this->hasRole(Profile_role::ADMINISTRATOR);
break;
+ case Right::GRANTROLE:
+ case Right::REVOKEROLE:
+ $result = $this->hasRole(Profile_role::OWNER);
+ break;
case Right::NEWNOTICE:
case Right::NEWMESSAGE:
case Right::SUBSCRIBE:
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);
+ }
}