From f1efb845e4955f398be3a7e36499474dc67bdade Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 16 Nov 2009 19:22:22 +0100 Subject: [PATCH] don't allow sandboxed users to post public notices --- classes/Notice.php | 5 ++--- classes/Profile.php | 3 +++ lib/right.php | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index fde40240f3..1db431f2a7 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -203,12 +203,11 @@ class Notice extends Memcached_DataObject $notice = new Notice(); $notice->profile_id = $profile_id; - $blacklist = common_config('public', 'blacklist'); $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))) { $notice->is_local = Notice::LOCAL_NONPUBLIC; } else { diff --git a/classes/Profile.php b/classes/Profile.php index e3b35533ad..291e3f0645 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -692,6 +692,9 @@ class Profile extends Memcached_DataObject case Right::NEWNOTICE: $result = !$this->isSilenced(); break; + case Right::PUBLICNOTICE: + $result = !$this->isSandboxed(); + break; default: $result = false; break; diff --git a/lib/right.php b/lib/right.php index ae8516602e..1a3a7d49a7 100644 --- a/lib/right.php +++ b/lib/right.php @@ -51,5 +51,6 @@ class Right const SILENCEUSER = 'silenceuser'; const SANDBOXUSER = 'sandboxuser'; const NEWNOTICE = 'newnotice'; + const PUBLICNOTICE = 'publicnotice'; } -- 2.39.5