Update of /cvs/scoop/scoop/lib/Scoop/Admin
In directory lithium.sabren.com:/tmp/cvs-serv27936/lib/Scoop/Admin
Modified Files:
Perms.pm
Log Message:
Fix for TU so you can check permissions with a var and $S->have_perm()
instead of mucking about with TRUSTLEV and super_mojo. The fix is fairly
small. The perms are listed in a var called 'tu_perms'. Eventually
comment rating should be changed to make use of this, but that hasn't
happened quite yet. -j
Index: Perms.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Admin/Perms.pm,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** Perms.pm 28 May 2005 01:56:28 -0000 1.20
--- Perms.pm 13 Jan 2006 23:28:50 -0000 1.21
***************
*** 170,173 ****
--- 170,193 ----
$userperm = $S->group_perms( $gid );
}
+
+ # TU perm checks. If the user in question is a trusted user, then we
+ # split a list of permissions trusted users have and add them to
+ # the userperm hash.
+ my @tuarr = split(/,/, $S->var('tu_perms'));
+ # make it a handy hashref
+ my $turef = {};
+ foreach my $tu (@tuarr){
+ $turef->{$tu} = 1;
+ }
+ # Only add the TU perm to the userperm hash if it's actually being
+ # checked (and if the user's actually trusted, of course)
+ # This avoids an endless loop that seems to happen if you put a check
+ # for supermojo in otherwise.
+ foreach my $chkperm (@all_check){
+ next if !$turef->{$chkperm};
+ if(($S->{TRUSTLEV} == 2 || $S->have_perm('super_mojo')) && ($gid eq $S->{GID})){
+ $userperm->{$chkperm} = $turef->{$chkperm};
+ }
+ }
# If the hash key is not there for any arg, we don't have access