forked from GNUsocial/gnu-social
define rights around how to silence, sandbox, and delete a user
This commit is contained in:
parent
e3b53565bb
commit
c9475c76a8
@ -720,10 +720,14 @@ class User extends Memcached_DataObject
|
||||
switch ($right)
|
||||
{
|
||||
case Right::DELETEOTHERSNOTICE:
|
||||
case Right::SANDBOXUSER:
|
||||
case Right::SILENCEUSER:
|
||||
case Right::DELETEUSER:
|
||||
$result = $this->hasRole(User_role::MODERATOR);
|
||||
break;
|
||||
case Right::CONFIGURESITE:
|
||||
$result = $this->hasRole(User_role::ADMINISTRATOR);
|
||||
break;
|
||||
default:
|
||||
$result = false;
|
||||
break;
|
||||
@ -774,4 +778,14 @@ class User extends Memcached_DataObject
|
||||
$block->delete();
|
||||
// XXX delete group block? Reset blocker?
|
||||
}
|
||||
|
||||
function isSandboxed()
|
||||
{
|
||||
return $this->hasRole(User_role::SANDBOXED);
|
||||
}
|
||||
|
||||
function isSilenced()
|
||||
{
|
||||
return $this->hasRole(User_role::SILENCED);
|
||||
}
|
||||
}
|
||||
|
@ -48,4 +48,6 @@ class User_role extends Memcached_DataObject
|
||||
|
||||
const MODERATOR = 'moderator';
|
||||
const ADMINISTRATOR = 'administrator';
|
||||
const SANDBOXED = 'sandboxed';
|
||||
const SILENCED = 'silenced';
|
||||
}
|
||||
|
@ -47,5 +47,8 @@ class Right
|
||||
{
|
||||
const DELETEOTHERSNOTICE = 'deleteothersnotice';
|
||||
const CONFIGURESITE = 'configuresite';
|
||||
const DELETEUSER = 'deleteuser';
|
||||
const SILENCEUSER = 'silenceuser';
|
||||
const SANDBOXUSER = 'sandboxuser';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user