capability class management\n"; $ret .= "
"; return $ret; } if ($mode eq "save") { return "Error: requires post" unless (LJ::did_post()); return"Error: You don't have access to change a user's capability class." unless (LJ::check_priv($remote, "admin", "*")); unless ($u) { $ret .= "Unknown user.\n"; return $ret; } my @cap_add = (); my @cap_del = (); my $newcaps = $u->{caps}; foreach my $n (sort { $a <=> $b } keys %LJ::CAP) { if ($FORM{"class_$n"}) { push @cap_add, $n; $newcaps |= (1 << $n); } else { push @cap_del, $n; $newcaps &= ~(1 << $n); } } # note which caps were changed and log $logmsg to statushistory my $add_txt = join(",", @cap_add); my $del_txt = join(",", @cap_del); LJ::statushistory_add($u->{'userid'}, $remote->{'userid'}, "capedit", "add: $add_txt, del: $del_txt\n"); LJ::modify_caps($u, \@cap_add, \@cap_del) or return"Error: Unable to modify caps."; # $u->{caps} is now updated in memory for later in this request $u->{caps} = $newcaps; $ret .= "Saved."; $mode = "viewuser"; } if ($mode eq "viewuser") { $ret .= "