Merge branch 'master' into 0.9.x
This commit is contained in:
commit
90c7ff1983
|
@ -66,6 +66,13 @@ class NewgroupAction extends Action
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user = common_current_user();
|
||||||
|
$profile = $user->getProfile();
|
||||||
|
if (!$profile->hasRight(Right::CREATEGROUP)) {
|
||||||
|
// TRANS: Client exception thrown when a user tries to create a group while banned.
|
||||||
|
throw new ClientException(_('You are not allowed to create groups on this site.'), 403);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -850,6 +850,7 @@ class Profile extends Memcached_DataObject
|
||||||
case Right::NEWNOTICE:
|
case Right::NEWNOTICE:
|
||||||
case Right::NEWMESSAGE:
|
case Right::NEWMESSAGE:
|
||||||
case Right::SUBSCRIBE:
|
case Right::SUBSCRIBE:
|
||||||
|
case Right::CREATEGROUP:
|
||||||
$result = !$this->isSilenced();
|
$result = !$this->isSilenced();
|
||||||
break;
|
break;
|
||||||
case Right::PUBLICNOTICE:
|
case Right::PUBLICNOTICE:
|
||||||
|
|
|
@ -476,6 +476,16 @@ class User_group extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
static function register($fields) {
|
static function register($fields) {
|
||||||
|
if (!empty($fields['userid'])) {
|
||||||
|
$profile = Profile::staticGet('id', $fields['userid']);
|
||||||
|
if ($profile && !$profile->hasRight(Right::CREATEGROUP)) {
|
||||||
|
common_log(LOG_WARNING, "Attempted group creation from banned user: " . $profile->nickname);
|
||||||
|
|
||||||
|
// TRANS: Client exception thrown when a user tries to create a group while banned.
|
||||||
|
throw new ClientException(_('You are not allowed to create groups on this site.'), 403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MAGICALLY put fields into current scope
|
// MAGICALLY put fields into current scope
|
||||||
|
|
||||||
extract($fields);
|
extract($fields);
|
||||||
|
|
|
@ -65,5 +65,6 @@ class Right
|
||||||
const RESTOREACCOUNT = 'restoreaccount';
|
const RESTOREACCOUNT = 'restoreaccount';
|
||||||
const DELETEACCOUNT = 'deleteaccount';
|
const DELETEACCOUNT = 'deleteaccount';
|
||||||
const MOVEACCOUNT = 'moveaccount';
|
const MOVEACCOUNT = 'moveaccount';
|
||||||
|
const CREATEGROUP = 'creategroup';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user