ENDCHANGEUSER
# Get the users information
my %userenv = &Apache::lonnet::get('environment',
@@ -873,8 +851,99 @@ sub custom_role_editor {
$r->print(&Apache::loncommon::bodytag(
'Create Users, Change User Privileges').'
');
+ my $syspriv='';
+ my $dompriv='';
+ my $coursepriv='';
+ my ($rdummy,$roledef)=
+ &Apache::lonnet::get('roles',["rolesdef_$rolename"]);
+# ------------------------------------------------------- Does this role exist?
+ if (($rdummy ne 'con_lost') && ($roledef ne '')) {
+ $r->print('Existing Role "');
+# ------------------------------------------------- Get current role privileges
+ ($syspriv,$dompriv,$coursepriv)=split(/\_/,$roledef);
+ $r->print($syspriv.' '.$dompriv.' '.$coursepriv);
+ } else {
+ $r->print('New Role "');
+ $roledef='';
+ }
+ $r->print($rolename.'"
');
+# ------------------------------------------------------- What can be assigned?
+ my %full=();
+ my %courselevel=();
+ my %courselevelcurrent=();
+ foreach (split(/\:/,$Apache::lonnet::pr{'cr:c'})) {
+ my ($priv,$restrict)=split(/\&/,$_);
+ unless ($restrict) { $restrict='F'; }
+ $courselevel{$priv}=$restrict;
+ if ($coursepriv=~/\:$priv/) {
+ $courselevelcurrent{$priv}=1;
+ }
+ $full{$priv}=1;
+ }
+ my %domainlevel=();
+ my %domainlevelcurrent=();
+ foreach (split(/\:/,$Apache::lonnet::pr{'cr:d'})) {
+ my ($priv,$restrict)=split(/\&/,$_);
+ unless ($restrict) { $restrict='F'; }
+ $domainlevel{$priv}=$restrict;
+ if ($dompriv=~/\:$priv/) {
+ $domainlevelcurrent{$priv}=1;
+ }
+ $full{$priv}=1;
+ }
+ my %systemlevel=();
+ my %systemlevelcurrent=();
+ foreach (split(/\:/,$Apache::lonnet::pr{'cr:s'})) {
+ my ($priv,$restrict)=split(/\&/,$_);
+ unless ($restrict) { $restrict='F'; }
+ $systemlevel{$priv}=$restrict;
+ if ($syspriv=~/\:$priv/) {
+ $systemlevelcurrent{$priv}=1;
+ }
+ $full{$priv}=1;
+ }
+ $r->print(<
+
+
+