afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-06-10 03:24 pm

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

[commit: http://hg.dwscoalition.org/dw-free/rev/86e9c7645063]

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

Use members/access as appropriate.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/Console/Command/TagPermissions.pm
--------------------------------------------------------------------------------
diff -r 1dd338c2158f -r 86e9c7645063 cgi-bin/LJ/Console/Command/TagPermissions.pm
--- a/cgi-bin/LJ/Console/Command/TagPermissions.pm	Wed Jun 10 14:57:53 2009 +0000
+++ b/cgi-bin/LJ/Console/Command/TagPermissions.pm	Wed Jun 10 15:23:52 2009 +0000
@@ -10,8 +10,8 @@ sub desc { "Set tagging permission level
 
 sub args_desc { [
                  'community' => "Optional; community to change permission levels for.",
-                 'add level' => "Accounts at this level can add existing tags to entries. One of 'public', 'friends', 'private', or a custom friend group name.",
-                 'control level' => "Accounts at this level can do everything: add, remove, and create new ones. Value is one of 'public', 'friends', 'private', or a custom friend group name.",
+                 'add level' => "Accounts at this level can add existing tags to entries. Value is one of 'public', 'access' (for personal journals), 'members' (for communities), 'private', 'none', or a custom group name.",
+                 'control level' => "Accounts at this level can do everything: add, remove, and create new tags. Value is one of 'public', 'access' (for personal journals), 'members' (for communities), 'private', 'none', or a custom group name.",
                  ] }
 
 sub usage { '[ "for" <community> ] <add level> <control level>' }
@@ -43,15 +43,18 @@ sub execute {
             unless LJ::can_manage($remote, $foru);
 
         ($add, $control) = ($args[2], $args[3]);
+        map { $_ = 'friends' if $_ eq 'members' } ($add, $control);
     } else {
         ($add, $control) = ($args[0], $args[1]);
+        map { $_ = 'friends' if $_ eq 'access' } ($add, $control);
     }
 
     my $validate_level = sub {
         my $level = shift;
         return $level if $level =~ /^(?:private|public|none|friends)$/;
+        return undef if $level =~ /^(?:members|access)$/;
 
-        my $grp = LJ::get_friend_group($foru, { name => $level });
+        my $grp = $foru->trust_groups( name => $level );
         return "group:$grp->{groupnum}" if $grp;
 
         return undef;
@@ -59,7 +62,7 @@ sub execute {
 
     $add = $validate_level->($add);
     $control = $validate_level->($control);
-    return $self->error("Levels must be one of: 'private', 'public', 'friends', or the name of a friends group.")
+    return $self->error("Levels must be one of: 'private', 'public', 'none', 'access' (for personal journals), 'members' (for communities), or the name of a custom group.")
         unless $add && $control;
 
     $foru->set_prop('opt_tagpermissions', "$add,$control");
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

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