[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm
raeburn
lon-capa-cvs-allow@mail.lon-capa.org
Wed, 08 Oct 2008 03:37:23 -0000
raeburn Tue Oct 7 23:37:23 2008 EDT
Modified files:
/loncom/auth lonroles.pm
Log:
- Ad hoc role for CC needs to set privs for any groups to which the CC belongs when selecting other roles in the course.
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.207 loncom/auth/lonroles.pm:1.208
--- loncom/auth/lonroles.pm:1.207 Thu Oct 2 10:34:03 2008
+++ loncom/auth/lonroles.pm Tue Oct 7 23:37:20 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.207 2008/10/02 14:34:03 www Exp $
+# $Id: lonroles.pm,v 1.208 2008/10/08 03:37:20 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1136,7 +1136,15 @@
return;
}
}
- my (%userroles,%newrole,%newgroups);
+ my (%userroles,%newrole,%newgroups,%group_privs);
+ my %cgroups =
+ &Apache::lonnet::get_active_groups($env{'user.domain'},
+ $env{'user.name'},$cdom,$cnum);
+ foreach my $group (keys(%cgroups)) {
+ $group_privs{$group} =
+ $env{'user.priv.cc./'.$cdom.'/'.$cnum.'./'.$cdom.'/'.$cnum.'/'.$group};
+ }
+ $newgroups{'/'.$cdom.'/'.$cnum} = \%group_privs;
my $area = '/'.$cdom.'/'.$cnum;
my $spec = $role.'.'.$area;
if ($usec ne '') {
@@ -1144,7 +1152,7 @@
$area .= '/'.$usec;
}
&Apache::lonnet::standard_roleprivs(\%newrole,$role,$cdom,$spec,$cnum,$area);
- &Apache::lonnet::set_userprivs(\%userroles,\%newrole,%newgroups);
+ &Apache::lonnet::set_userprivs(\%userroles,\%newrole,\%newgroups);
my $adhocstart = $then-1;
$userroles{'user.role.'.$spec} = $adhocstart.'.';
&Apache::lonnet::appenv(\%userroles,[$role,'cm']);