version 1.58, 2003/07/17 18:14:41
|
version 1.60, 2003/07/18 13:45:14
|
Line 83 BEGIN {
|
Line 83 BEGIN {
|
} |
} |
|
|
|
|
|
# ======================================================= Existing Custom Roles |
|
|
|
sub my_custom_roles { |
|
my %returnhash=(); |
|
my %rolehash=&Apache::lonnet::dump('roles'); |
|
foreach (keys %rolehash) { |
|
if ($_=~/^rolesdef\_(\w+)$/) { |
|
$returnhash{$_}=$_; |
|
} |
|
} |
|
return %returnhash; |
|
} |
|
|
# ==================================================== Figure out author access |
# ==================================================== Figure out author access |
|
|
Line 107 sub print_username_entry_form {
|
Line 119 sub print_username_entry_form {
|
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $sellink=&Apache::loncommon::selectstudent_link |
my $sellink=&Apache::loncommon::selectstudent_link |
('crtuser','ccuname','ccdomain'); |
('crtuser','ccuname','ccdomain'); |
|
my %existingroles=&my_custom_roles(); |
|
my $choice=&Apache::loncommon::select_form('make new role','rolename', |
|
('make new role' => 'Generate new role ...',%existingroles)); |
$r->print(<<"ENDDOCUMENT"); |
$r->print(<<"ENDDOCUMENT"); |
<html> |
<html> |
<head> |
<head> |
Line 127 Domain:</td><td>$domform</td></tr>
|
Line 142 Domain:</td><td>$domform</td></tr>
|
<form action="/adm/createuser" method="post" name="docustom"> |
<form action="/adm/createuser" method="post" name="docustom"> |
<input type="hidden" name="phase" value="selected_custom_edit"> |
<input type="hidden" name="phase" value="selected_custom_edit"> |
<h2>Edit Custom Role Privileges</h2> |
<h2>Edit Custom Role Privileges</h2> |
Name of Role: <input type="text" size="15" name="rolename" /><br /> |
Name of Role: $choice <input type="text" size="15" name="newrolename" /><br /> |
<input name="customeditor" type="submit" value="Custom Role Editor" /> |
<input name="customeditor" type="submit" value="Custom Role Editor" /> |
</body> |
</body> |
</html> |
</html> |
Line 249 ENDNEWUSER
|
Line 264 ENDNEWUSER
|
$dochead |
$dochead |
<h1>Change User Privileges</h1> |
<h1>Change User Privileges</h1> |
$forminfo |
$forminfo |
<h2>User "$ccuname" in domain $ccdomain </h2> |
<h2>User "$ccuname" in domain "$ccdomain"</h2> |
ENDCHANGEUSER |
ENDCHANGEUSER |
# Get the users information |
# Get the users information |
my %userenv = &Apache::lonnet::get('environment', |
my %userenv = &Apache::lonnet::get('environment', |
Line 845 sub custom_role_editor {
|
Line 860 sub custom_role_editor {
|
my $r=shift; |
my $r=shift; |
my $rolename=$ENV{'form.rolename'}; |
my $rolename=$ENV{'form.rolename'}; |
|
|
|
if ($rolename eq 'make new role') { |
|
$rolename=$ENV{'form.newrolename'}; |
|
} |
|
|
$rolename=~s/\W//gs; |
$rolename=~s/\W//gs; |
|
|
unless ($rolename) { |
unless ($rolename) { |
Line 853 sub custom_role_editor {
|
Line 872 sub custom_role_editor {
|
} |
} |
|
|
$r->print(&Apache::loncommon::bodytag( |
$r->print(&Apache::loncommon::bodytag( |
'Create Users, Change User Privileges')); |
'Create Users, Change User Privileges').'<h2>'); |
$r->print('Not yet implemented.'); |
my ($rdummy,$roledef)= |
|
&Apache::lonnet::get('roles',["rolesdef_$rolename"]); |
|
# ------------------------------------------------------- Does this role exist? |
|
if (($rdummy ne 'con_lost') && ($roledef ne '')) { |
|
$r->print('Existing Role "'); |
|
} else { |
|
$r->print('New Role "'); |
|
$roledef=''; |
|
} |
|
$r->print($rolename.'"</h2>'); |
|
# ------------------------------------------------------- What can be assigned? |
|
my %full=(); |
|
my %courselevel=(); |
|
foreach (split(/\:/,$Apache::lonnet::pr{'cr:c'})) { |
|
my ($priv,$restrict)=split(/\&/,$_); |
|
unless ($restrict) { $restrict='F'; } |
|
$courselevel{$priv}=$restrict; |
|
$full{$priv}=1; |
|
} |
|
my %domainlevel=(); |
|
foreach (split(/\:/,$Apache::lonnet::pr{'cr:d'})) { |
|
my ($priv,$restrict)=split(/\&/,$_); |
|
unless ($restrict) { $restrict='F'; } |
|
$domainlevel{$priv}=$restrict; |
|
$full{$priv}=1; |
|
} |
|
$r->print('<table border="2"><tr><th>Privilege</th><th>Course Level</th><th>Domain Level</th></tr>'); |
|
foreach (sort keys %full) { |
|
$r->print('<tr><td>'.&Apache::lonnet::plaintext($_).'</td><td>'. |
|
$courselevel{$_}.'</td><td>'.$domainlevel{$_}.'</td></tr>'); |
|
} |
|
$r->print('</table>'); |
|
$r->print('Not yet implemented.'); |
} |
} |
|
|
# ================================================================ Main Handler |
# ================================================================ Main Handler |