[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
raeburn
raeburn at source.lon-capa.org
Mon Aug 8 21:06:34 EDT 2011
raeburn Tue Aug 9 01:06:34 2011 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
- Extend &is_advanced_user() to also check if user has active author role
- returns $is_adv and $is_author, if wantarray.
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1127 loncom/lonnet/perl/lonnet.pm:1.1128
--- loncom/lonnet/perl/lonnet.pm:1.1127 Tue Aug 9 00:54:48 2011
+++ loncom/lonnet/perl/lonnet.pm Tue Aug 9 01:06:33 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.1127 2011/08/09 00:54:48 raeburn Exp $
+# $Id: lonnet.pm,v 1.1128 2011/08/09 01:06:33 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -5378,12 +5378,16 @@
my ($udom,$uname) = @_;
if ($udom ne '' && $uname ne '') {
if (($udom eq $env{'user.domain'}) && ($uname eq $env{'user.name'})) {
- return $env{'user.adv'};
+ if (wantarray) {
+ return ($env{'user.adv'},$env{'user.author'});
+ } else {
+ return $env{'user.adv'};
+ }
}
}
my %roleshash = &get_my_roles($uname,$udom,'userroles',undef,undef,undef,1);
my %allroles;
- my $is_adv;
+ my ($is_adv,$is_author);
foreach my $role (keys(%roleshash)) {
my ($trest,$tdomain,$trole,$sec) = split(/:/,$role);
my $area = '/'.$tdomain.'/'.$trest;
@@ -5397,6 +5401,9 @@
} elsif ($trole ne 'gr') {
&standard_roleprivs(\%allroles,$trole,$tdomain,$spec,$trest,$area);
}
+ if ($trole eq 'au') {
+ $is_author = 1;
+ }
}
}
foreach my $role (keys(%allroles)) {
@@ -5411,6 +5418,9 @@
}
}
}
+ if (wantarray) {
+ return ($is_adv,$is_author);
+ }
return $is_adv;
}
More information about the LON-CAPA-cvs
mailing list