');
- foreach (sort split(/:/,$env{$envkey})) {
- if ($_) {
- my ($prv,$restr)=split(/\&/,$_);
- my $trestr='';
- if ($restr ne 'F') {
- my $i;
- $trestr.=' (';
- for ($i=0;$iprint('
'.
- Apache::lonnet::plaintext($prv).$trestr.
- '
');
- }
- }
- $r->print('
');
- }
- }
+ $r->print(&privileges_info());
}
$r->print(&Apache::lonnet::getannounce());
if ($advanced) {
@@ -803,6 +753,61 @@ ENDHEADER
return OK;
}
+sub privileges_info {
+ my ($which) = @_;
+ my $output;
+
+ $which ||= $env{'request.role'};
+
+ foreach my $envkey (sort(keys(%env))) {
+ next if ($envkey!~/^user\.priv\.\Q$which\E\.(.*)/);
+
+ my $where=$1;
+ my $ttype;
+ my $twhere;
+ my (undef,$tdom,$trest,$tsec)=split(m{/},$where);
+ if ($trest) {
+ if ($env{'course.'.$tdom.'_'.$trest.'.description'} eq 'ca') {
+ $ttype='Construction Space';
+ $twhere='User: '.$trest.', Domain: '.$tdom;
+ } else {
+ $ttype= &Apache::loncommon::course_type($tdom.'_'.$trest);
+ $twhere=$env{'course.'.$tdom.'_'.$trest.'.description'};
+ if ($tsec) {
+ my $sec_type = 'Section';
+ if (exists($env{"user.role.gr.$where"})) {
+ $sec_type = 'Group';
+ }
+ $twhere.=' ('.$sec_type.': '.$tsec.')';
+ }
+ }
+ } elsif ($tdom) {
+ $ttype='Domain';
+ $twhere=$tdom;
+ } else {
+ $ttype='System';
+ $twhere='/';
+ }
+ $output .= "\n
".$ttype.': '.$twhere.'
'."\n
";
+ foreach my $priv (sort(split(/:/,$env{$envkey}))) {
+ next if (!$priv);
+
+ my ($prv,$restr)=split(/\&/,$priv);
+ my $trestr='';
+ if ($restr ne 'F') {
+ $trestr.=' ('.
+ join(', ',
+ map { &Apache::lonnet::plaintext($_) }
+ (split('',$restr))).') ';
+ }
+ $output .= "\n\t".
+ '
'.&Apache::lonnet::plaintext($prv).$trestr.'
';
+ }
+ $output .= "\n".'
';
+ }
+ return $output;
+}
+
sub role_status {
my ($rolekey,$then,$now,$role,$where,$trolecode,$tstatus,$tstart,$tend) = @_;
my @pwhere = ();
@@ -830,7 +835,7 @@ sub role_status {
sub build_roletext {
my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver) = @_;
- my $roletext='
';
+ my $roletext='
';
my $is_dc=($trolecode =~ m/^dc\./);
my $rowspan=($is_dc) ? ''
: ' rowspan="2" ';
@@ -840,8 +845,8 @@ sub build_roletext {
$buttonname=~s/\W//g;
if (!$button) {
if ($switchserver) {
- $roletext.='