kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2009-08-16 04:06 am

[dw-free] Tag security uses 'friends' terminology

[commit: http://hg.dwscoalition.org/dw-free/rev/229b842c341e]

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

Update tag management backend to use "protected" instead of "friends".

Patch by [personal profile] foxfirefey.

Files modified:
  • cgi-bin/taglib.pl
  • htdocs/js/tags.js
  • htdocs/manage/tags.bml
  • htdocs/manage/tags.bml.text
--------------------------------------------------------------------------------
diff -r efcab63518c5 -r 229b842c341e cgi-bin/taglib.pl
--- a/cgi-bin/taglib.pl	Sat Aug 15 04:53:45 2009 +0000
+++ b/cgi-bin/taglib.pl	Sat Aug 15 23:06:29 2009 -0500
@@ -187,7 +187,7 @@ sub _get_usertagsmulti {
                             public => 0,
                             groups => {},
                             private => 0,
-                            friends => 0
+                            protected => 0
                         },
                         uses => 0,
                         display => $tags{$jid}->{$kwid},
@@ -206,7 +206,7 @@ sub _get_usertagsmulti {
 
         # setup some helper values
         my $public_mask = 1 << 63;
-        my $friends_mask = 1 << 0;
+        my $trust_mask = 1 << 0;
 
         # melt this information down into the hashref
         foreach my $row (@$counts) {
@@ -222,12 +222,12 @@ sub _get_usertagsmulti {
             if ($sec & $public_mask) {
                 $res->{$jid}->{$kwid}->{security}->{public} += $ct;
                 $res->{$jid}->{$kwid}->{security_level} = 'public';
-            } elsif ($sec & $friends_mask) {
-                $res->{$jid}->{$kwid}->{security}->{friends} += $ct;
-                $res->{$jid}->{$kwid}->{security_level} = 'friends'
+            } elsif ($sec & $trust_mask) {
+                $res->{$jid}->{$kwid}->{security}->{protected} += $ct;
+                $res->{$jid}->{$kwid}->{security_level} = 'protected'
                     unless $res->{$jid}->{$kwid}->{security_level} eq 'public';
             } elsif ($sec) {
-                # if $sec is true (>0), and not friends/public, then it's a group.  but it's
+                # if $sec is true (>0), and not trust/public, then it's a group.  but it's
                 # still in the form of a number, and we want to know which group it is.  so
                 # we must convert the mask back to a bit number with LJ::bit_breakdown.  but
                 # we will only ever have one mask, so we just accept that.
@@ -284,9 +284,9 @@ sub get_usertags {
         return $res if LJ::can_manage($opts->{remote}, $u);
 
         # setup helper variables from u to remote
-        my ($is_friend, $grpmask) = (0, 0);
+        my ($trusted, $grpmask) = (0, 0);
         if ($opts->{remote}) {
-            $is_friend = $u->trusts_or_has_member( $opts->{remote} );
+            $trusted = $u->trusts_or_has_member( $opts->{remote} );
             $grpmask = $u->trustmask( $opts->{remote} );
         }
 
@@ -295,7 +295,7 @@ TAG:    foreach my $tagid (keys %$res) {
 TAG:    foreach my $tagid (keys %$res) {
             my $sec = $res->{$tagid}->{security_level};
             next TAG if $sec eq 'public';
-            next TAG if $is_friend && $sec eq 'friends';
+            next TAG if $trusted && $sec eq 'protected';
             if ($grpmask && $sec eq 'group') {
                 foreach my $grpid (keys %{$res->{$tagid}->{security}->{groups}}) {
                     next TAG if $grpmask & (1 << $grpid);
@@ -507,7 +507,7 @@ sub _remote_satisfies_permission {
         return 1;
     } elsif ($perm eq 'none') {
         return 0;
-    } elsif ($perm eq 'friends') {
+    } elsif ($perm eq 'protected') {
         return $u->trusts_or_has_member( $remote );
     } elsif ($perm eq 'private') {
         return LJ::can_manage($remote, $u);
@@ -530,8 +530,8 @@ sub _remote_satisfies_permission {
 # args: uobj
 # des-uobj: User id or object of account to get permissions for.
 # returns: Hashref; keys one of 'add', 'control'; values being 'private' (only the account
-#          in question), 'friends' (all friends), 'public' (everybody), 'group:N' (one
-#          friend group with given id), or 'none' (nobody can).
+#          in question), 'protected' (all trusted), 'public' (everybody), 'group:N' (one
+#          trust group with given id), or 'none' (nobody can).
 # </LJFUNC>
 sub get_permission_levels {
     return { add => 'none', control => 'none' }
@@ -546,10 +546,10 @@ sub get_permission_levels {
     # return defaults for accounts
     unless ($u->{opt_tagpermissions}) {
         if ( $u->is_community ) {
-            # communities are members (friends) add, private (maintainers) control
-            return { add => 'friends', control => 'private' };
+            # communities are members (trusted) add, private (maintainers) control
+            return { add => 'protected', control => 'private' };
         } elsif ( $u->is_person ) {
-            # people let friends add, self control
+            # people let trusted add, self control
             return { add => 'private', control => 'private' };
         } else {
             # other account types can't add tags
@@ -641,7 +641,7 @@ sub get_security_breakdown {
         @out = (1 << 63);
     } else {
         # have to get each group bit into a mask
-        foreach my $bit (0..60) { # include 0 for friends only
+        foreach my $bit (0..60) { # include 0 for trusted only
             if ($mask & (1 << $bit)) {
                 push @out, (1 << $bit);
             }
@@ -699,7 +699,7 @@ sub update_logtags {
     my $remote = LJ::want_user(delete $opts->{remote});
     return undef unless $remote || $opts->{force};
 
-    # get access levels
+    # get trust levels
     my $can_control = LJ::Tags::can_control_tags($u, $remote);
     my $can_add = $can_control || LJ::Tags::can_add_tags($u, $remote);
 
@@ -1307,10 +1307,10 @@ sub set_usertag_display {
 # <LJFUNC>
 # name: LJ::Tags::deleted_trust_group
 # class: tags
-# des: Called from ljprotocol when a friends group is deleted.
+# des: Called from ljprotocol when a trust group is deleted.
 # args: uobj, bit
 # des-uobj: User id or object of account deleting the group.
-# des-bit: The id (1..60) of the friends group being deleted.
+# des-bit: The id (1..60) of the trust group being deleted.
 # returns: 1 of success undef on failure.
 # </LJFUNC>
 sub deleted_trust_group {
diff -r efcab63518c5 -r 229b842c341e htdocs/js/tags.js
--- a/htdocs/js/tags.js	Sat Aug 15 04:53:45 2009 +0000
+++ b/htdocs/js/tags.js	Sat Aug 15 23:06:29 2009 -0500
@@ -129,7 +129,7 @@ function show_props(div, id)
         secimg = secimg + "silk/entry/private.png";
         seclabel = ml.private_label;
     }
-    else if (tag[1] == "friends") {
+    else if (tag[1] == "protected") {
         secimg = secimg + "silk/entry/locked.png";
         seclabel = ml.trusted_label;
     } 
diff -r efcab63518c5 -r 229b842c341e htdocs/manage/tags.bml
--- a/htdocs/manage/tags.bml	Sat Aug 15 04:53:45 2009 +0000
+++ b/htdocs/manage/tags.bml	Sat Aug 15 23:06:29 2009 -0500
@@ -84,8 +84,8 @@ HEAD
             my $control = $POST{"control_level"};
 
             $ret .= "<?errorbar $ML{'.error.invalidsettings'} errorbar?>"
-               unless $add =~ /^(?:private|public|friends|group:\d+)$/ &&
-               $control =~ /^(?:private|public|friends|group:\d+)$/;
+               unless $add =~ /^(?:private|public|protected|group:\d+)$/ &&
+               $control =~ /^(?:private|public|protected|group:\d+)$/;
 
             $u->set_prop("opt_tagpermissions", "$add,$control");
         }
@@ -166,7 +166,7 @@ HEAD
         my $sec = $tag->{security};
         my ($pub, $pri, $fr, $tot) =
                 ($sec->{public}, $sec->{private},
-                 $sec->{friends}, $tag->{uses});
+                 $sec->{protected}, $tag->{uses});
         my $grp = $tot - ($pub+$pri+$fr);
         $ret .= "tags[$_] = [ '" . LJ::ejs($tag->{name}) . "', '$tag->{security_level}', $pub, $pri, $fr, $grp, $tot ];\n";
     }
@@ -294,10 +294,10 @@ HEAD
     my @groups = ("public", $ML{'.setting.public'});
 
     if ($u->is_person) {
-        push @groups, ("friends", $ML{'.setting.friends'});
+        push @groups, ("protected", $ML{'.setting.trusted'});
         push @groups, ("private", $ML{'.setting.private'});
     } else {
-        push @groups, ("friends", $ML{'.setting.members'});
+        push @groups, ("protected", $ML{'.setting.members'});
         push @groups, ("private", $ML{'.setting.maintainers'});
     }
 
diff -r efcab63518c5 -r 229b842c341e htdocs/manage/tags.bml.text
--- a/htdocs/manage/tags.bml.text	Sat Aug 15 04:53:45 2009 +0000
+++ b/htdocs/manage/tags.bml.text	Sat Aug 15 23:06:29 2009 -0500
@@ -55,7 +55,7 @@
 
 .setting.public=Any user
 
-.setting.friends=Friends only
+.setting.trusted=Access only
 
 .setting.maintainers=Only maintainers
 
--------------------------------------------------------------------------------

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