wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r18782: LJSV-1416. Moderators unable to view lis...

Committer: gprochaev
LJSV-1416. Moderators unable to view list of existing tags

U   trunk/cgi-bin/taglib.pl
Modified: trunk/cgi-bin/taglib.pl
===================================================================
--- trunk/cgi-bin/taglib.pl	2011-04-04 08:06:46 UTC (rev 18781)
+++ trunk/cgi-bin/taglib.pl	2011-04-04 08:14:37 UTC (rev 18782)
@@ -498,9 +498,9 @@
     my $perms = LJ::Tags::get_permission_levels($journal);
     if ($perms->{add} eq 'author_moder'){
         return 1 if $remote==$entry->poster; # check author
-        return $remote->can_manage($entry->journal);  # check moder
+        return $remote->can_manage($entry->journal);  # check maintainer
     }
-    
+ 
     ## generic case: if $remote can add tags to the entire journal of the entry
     return 1 if LJ::Tags::can_add_tags($journal, $remote);
     
@@ -529,17 +529,19 @@
 
     # get permission hashref and check it
     my $perms = LJ::Tags::get_permission_levels($u);
-    return LJ::Tags::_remote_satisfies_permission($u, $remote, $perms->{control});
+    return LJ::Tags::_remote_satisfies_permission($u, $remote, $perms->{control}, 'control');
 }
 
 # helper sub internal used by can_*_tags functions
 sub _remote_satisfies_permission {
-    my ($u, $remote, $perm) = @_;
+    my ($u, $remote, $perm, $type) = @_;
     return undef unless $u && $remote && $perm;
 
     # allow if they can manage it (own, or 'A' edge)
     return 1 if $remote->can_manage($u);
 
+    $type = "add" unless $type;
+
     # permission checks
     if ($perm eq 'public') {
         return 1;
@@ -547,8 +549,10 @@
         return 0;
     } elsif ($perm eq 'friends') {
         return LJ::is_friend($u, $remote);
-    } elsif ($perm eq 'private') {
+    } elsif ($perm eq 'private' && $type eq 'add') {
         return $remote->can_manage($u) || $remote->can_moderate($u);
+    } elsif ($perm eq 'private' && $type eq 'control') {
+        return $remote->can_manage($u);
     } elsif ($perm eq 'author_moder'){
         return ($remote->can_manage($u) || LJ::is_friend($u, $remote));
     } elsif ($perm =~ /^group:(\d+)$/) {

Tags: livejournal, pl, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments