mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-06-12 09:48 pm

[dw-free] update console command for setting minimum security

[commit: http://hg.dwscoalition.org/dw-free/rev/4095983b9f9e]

http://bugs.dwscoalition.org/show_bug.cgi?id=982

Update console command for minsec to use access/members instead of
'friends'.

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/ljhooks.pl
--------------------------------------------------------------------------------
diff -r 9c1ecf129339 -r 4095983b9f9e cgi-bin/ljhooks.pl
--- a/cgi-bin/ljhooks.pl	Fri Jun 12 21:45:13 2009 +0000
+++ b/cgi-bin/ljhooks.pl	Fri Jun 12 21:48:33 2009 +0000
@@ -120,16 +120,27 @@ register_setter('synlevel', sub {
 
 register_setter("newpost_minsecurity", sub {
     my ($u, $key, $value, $err) = @_;
-    unless ($value =~ /^(public|friends|private)$/) {
-        $$err = "Illegal value.  Must be 'public', 'friends', or 'private'";
+    unless ($value =~ /^(public|access|members|private|friends)$/) {
+        $$err = "Illegal value.  Must be 'public', 'access' (for personal journals), 'members' (for communities), or 'private'";
         return 0;
     }
-    # Don't let commmunities be private
-    if ($u->{'journaltype'} eq "C" && $value eq "private") {
-        $$err = "newpost_minsecurity cannot be private for communities";
+    # Don't let commmunities be private or access-locked
+    if ( $u->is_community ) {
+        if ( $value eq "private" ) {
+            $$err = "newpost_minsecurity cannot be private for communities";
+            return 0;
+        } elsif ( $value eq "access" ) {
+            $$err = "newpost_minsecurity cannot be access-locked for communities (use 'members' instead)";
+            return 0;
+        }
+    }
+    if ( $u->is_individual && $value eq "members" ) {
+        $$err = "newpost_minsecurity members not applicable to non-community journals. (use 'access' instead)";
         return 0;
     }
+    
     $value = "" if $value eq "public";
+    $value = "friends" if $value eq "access" || $value eq "members";
 
     $u->set_prop("newpost_minsecurity", $value);
     return 1;
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
No Subject Icon Selected
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org