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:11 pm

[dw-free] giving access in console resets access groups

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

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

Make console add_access command add someone to groups, not replace their
groups.

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/DW/Console/Command/ManageCircle.pm
--------------------------------------------------------------------------------
diff -r f3b13011c03c -r f814352fdaab cgi-bin/DW/Console/Command/ManageCircle.pm
--- a/cgi-bin/DW/Console/Command/ManageCircle.pm	Fri Jun 12 21:04:00 2009 +0000
+++ b/cgi-bin/DW/Console/Command/ManageCircle.pm	Fri Jun 12 21:11:11 2009 +0000
@@ -29,7 +29,7 @@ sub args_desc {
     [
         'command' => 'Subcommand: add_read, del_read, add_access, del_access.',
         'username' => 'Username to act on.',
-        'groups' => 'If using add_access, a comma separated list of trust group ids.',
+        'groups' => 'If using add_access, a comma separated list of trust group ids. Will add to the list of groups this user is already in.',
     ]
 }
 sub usage { '<subcommand> <username> [groups]' }
@@ -70,6 +70,10 @@ sub execute {
     } elsif ( $cmd eq 'add_access' ) {
         my $mask = 0;
         $mask += ( 1 << $_ ) foreach @groups;
+        
+        my $existing_mask = $remote->trustmask( $to_u );
+        $mask |= $existing_mask;
+
         $remote->add_edge( $to_u, trust => {
             mask => $mask,
             nonotify => $remote->trusts( $to_u ) ? 1 : 0,
--------------------------------------------------------------------------------