Moderator can make users admins of a group

This commit is contained in:
Evan Prodromou 2010-02-06 11:36:59 +01:00
parent 823939ca84
commit 5fdcd88176
4 changed files with 7 additions and 2 deletions

View File

@ -192,7 +192,9 @@ class GroupMemberListItem extends ProfileListItem
{ {
$user = common_current_user(); $user = common_current_user();
if (!empty($user) && $user->id != $this->profile->id && $user->isAdmin($this->group) && if (!empty($user) &&
$user->id != $this->profile->id &&
($user->isAdmin($this->group) || $user->hasRight(Right::MAKEGROUPADMIN)) &&
!$this->profile->isAdmin($this->group)) { !$this->profile->isAdmin($this->group)) {
$this->out->elementStart('li', 'entity_make_admin'); $this->out->elementStart('li', 'entity_make_admin');
$maf = new MakeAdminForm($this->out, $this->profile, $this->group, $maf = new MakeAdminForm($this->out, $this->profile, $this->group,

View File

@ -87,7 +87,8 @@ class MakeadminAction extends Action
return false; return false;
} }
$user = common_current_user(); $user = common_current_user();
if (!$user->isAdmin($this->group)) { if (!$user->isAdmin($this->group) &&
!$user->hasRight(Right::MAKEGROUPADMIN)) {
$this->clientError(_('Only an admin can make another user an admin.'), 401); $this->clientError(_('Only an admin can make another user an admin.'), 401);
return false; return false;
} }

View File

@ -716,6 +716,7 @@ class Profile extends Memcached_DataObject
switch ($right) switch ($right)
{ {
case Right::DELETEOTHERSNOTICE: case Right::DELETEOTHERSNOTICE:
case Right::MAKEGROUPADMIN:
case Right::SANDBOXUSER: case Right::SANDBOXUSER:
case Right::SILENCEUSER: case Right::SILENCEUSER:
case Right::DELETEUSER: case Right::DELETEUSER:

View File

@ -57,5 +57,6 @@ class Right
const EMAILONREPLY = 'emailonreply'; const EMAILONREPLY = 'emailonreply';
const EMAILONSUBSCRIBE = 'emailonsubscribe'; const EMAILONSUBSCRIBE = 'emailonsubscribe';
const EMAILONFAVE = 'emailonfave'; const EMAILONFAVE = 'emailonfave';
const MAKEGROUPADMIN = 'makegroupadmin';
} }