don't allow sandboxed users to post public notices
This commit is contained in:
parent
d2145a5b7f
commit
f1efb845e4
|
@ -203,12 +203,11 @@ class Notice extends Memcached_DataObject
|
||||||
$notice = new Notice();
|
$notice = new Notice();
|
||||||
$notice->profile_id = $profile_id;
|
$notice->profile_id = $profile_id;
|
||||||
|
|
||||||
$blacklist = common_config('public', 'blacklist');
|
|
||||||
$autosource = common_config('public', 'autosource');
|
$autosource = common_config('public', 'autosource');
|
||||||
|
|
||||||
# Blacklisted are non-false, but not 1, either
|
# Sandboxed are non-false, but not 1, either
|
||||||
|
|
||||||
if (($blacklist && in_array($profile_id, $blacklist)) ||
|
if (!$user->hasRight(Right::PUBLICNOTICE) ||
|
||||||
($source && $autosource && in_array($source, $autosource))) {
|
($source && $autosource && in_array($source, $autosource))) {
|
||||||
$notice->is_local = Notice::LOCAL_NONPUBLIC;
|
$notice->is_local = Notice::LOCAL_NONPUBLIC;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -692,6 +692,9 @@ class Profile extends Memcached_DataObject
|
||||||
case Right::NEWNOTICE:
|
case Right::NEWNOTICE:
|
||||||
$result = !$this->isSilenced();
|
$result = !$this->isSilenced();
|
||||||
break;
|
break;
|
||||||
|
case Right::PUBLICNOTICE:
|
||||||
|
$result = !$this->isSandboxed();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$result = false;
|
$result = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -51,5 +51,6 @@ class Right
|
||||||
const SILENCEUSER = 'silenceuser';
|
const SILENCEUSER = 'silenceuser';
|
||||||
const SANDBOXUSER = 'sandboxuser';
|
const SANDBOXUSER = 'sandboxuser';
|
||||||
const NEWNOTICE = 'newnotice';
|
const NEWNOTICE = 'newnotice';
|
||||||
|
const PUBLICNOTICE = 'publicnotice';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user