]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
don't allow sandboxed users to post public notices
authorEvan Prodromou <evan@status.net>
Mon, 16 Nov 2009 18:22:22 +0000 (19:22 +0100)
committerEvan Prodromou <evan@status.net>
Mon, 16 Nov 2009 18:22:22 +0000 (19:22 +0100)
classes/Notice.php
classes/Profile.php
lib/right.php

index fde40240f350026f0d5963ee5c592f0899281bf2..1db431f2a76d7fb59371571234b8c49d7ac3ffbd 100644 (file)
@@ -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 {
index e3b35533ad5224fb6f0d6d80fc126bde9a47aa26..291e3f0645fcdd095f1723f5cd1deb66b51b36d8 100644 (file)
@@ -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;
index ae8516602e9ab5742cdb819a55e6d565cba5d55c..1a3a7d49a79515cf15ed60de56d1e5c6d0df52c3 100644 (file)
@@ -51,5 +51,6 @@ class Right
     const SILENCEUSER        = 'silenceuser';
     const SANDBOXUSER        = 'sandboxuser';
     const NEWNOTICE          = 'newnotice';
+    const PUBLICNOTICE       = 'publicnotice';
 }