version 1.1226, 2015/08/05 18:47:21
|
version 1.1228, 2015/08/16 20:45:41
|
Line 2271 See lonrights.pm for an example invocati
|
Line 2271 See lonrights.pm for an example invocati
|
|
|
#------------------------------------------- |
#------------------------------------------- |
sub select_form { |
sub select_form { |
my ($def,$name,$hashref,$onchange) = @_; |
my ($def,$name,$hashref,$onchange,$readonly) = @_; |
return unless (ref($hashref) eq 'HASH'); |
return unless (ref($hashref) eq 'HASH'); |
if ($onchange) { |
if ($onchange) { |
$onchange = ' onchange="'.$onchange.'"'; |
$onchange = ' onchange="'.$onchange.'"'; |
} |
} |
my $selectform = "<select name=\"$name\" size=\"1\"$onchange>\n"; |
my $disabled; |
|
if ($readonly) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
|
my $selectform = "<select name=\"$name\" size=\"1\"$onchange$disabled>\n"; |
my @keys; |
my @keys; |
if (exists($hashref->{'select_form_order'})) { |
if (exists($hashref->{'select_form_order'})) { |
@keys=@{$hashref->{'select_form_order'}}; |
@keys=@{$hashref->{'select_form_order'}}; |
Line 9779 sub user_rule_check {
|
Line 9783 sub user_rule_check {
|
if ($checkid) { |
if ($checkid) { |
if (ref($usershash->{$user}) eq 'HASH') { |
if (ref($usershash->{$user}) eq 'HASH') { |
if ($usershash->{$user}->{'id'} ne '') { |
if ($usershash->{$user}->{'id'} ne '') { |
$by_id{$udom}{$usershash->{$user}->{'id'}} = 1; |
$by_id{$udom}{$usershash->{$user}->{'id'}} = $uname; |
$userdoms{$udom} = 1; |
$userdoms{$udom} = 1; |
|
if (ref($inst_results) eq 'HASH') { |
|
$inst_results->{$uname.':'.$udom} = {}; |
|
} |
} |
} |
} |
} |
} else { |
} else { |
$by_username{$udom}{$uname} = 1; |
$by_username{$udom}{$uname} = 1; |
$userdoms{$udom} = 1; |
$userdoms{$udom} = 1; |
|
if (ref($inst_results) eq 'HASH') { |
|
$inst_results->{$uname.':'.$udom} = {}; |
|
} |
} |
} |
} |
} |
foreach my $udom (keys(%userdoms)) { |
foreach my $udom (keys(%userdoms)) { |
Line 9795 sub user_rule_check {
|
Line 9805 sub user_rule_check {
|
if (ref($domconfig{'usercreation'}) eq 'HASH') { |
if (ref($domconfig{'usercreation'}) eq 'HASH') { |
foreach my $item ('username','id') { |
foreach my $item ('username','id') { |
if (ref($domconfig{'usercreation'}{$item.'_rule'}) eq 'ARRAY') { |
if (ref($domconfig{'usercreation'}{$item.'_rule'}) eq 'ARRAY') { |
$$curr_rules{$udom}{$item} = |
$$curr_rules{$udom}{$item} = |
$domconfig{'usercreation'}{$item.'_rule'}; |
$domconfig{'usercreation'}{$item.'_rule'}; |
} |
} |
} |
} |
} |
} |
Line 9807 sub user_rule_check {
|
Line 9817 sub user_rule_check {
|
foreach my $udom (keys(%by_id)) { |
foreach my $udom (keys(%by_id)) { |
my ($outcome,$results) = &Apache::lonnet::get_multiple_instusers($udom,$by_id{$udom},'id'); |
my ($outcome,$results) = &Apache::lonnet::get_multiple_instusers($udom,$by_id{$udom},'id'); |
if ($outcome eq 'ok') { |
if ($outcome eq 'ok') { |
|
foreach my $id (keys(%{$by_id{$udom}})) { |
|
my $uname = $by_id{$udom}{$id}; |
|
$inst_response{$uname.':'.$udom} = $outcome; |
|
} |
if (ref($results) eq 'HASH') { |
if (ref($results) eq 'HASH') { |
foreach my $uname (keys(%{$results})) { |
foreach my $uname (keys(%{$results})) { |
$inst_response{$uname.':'.$udom} = $outcome; |
if (exists($inst_response{$uname.':'.$udom})) { |
$inst_results->{$uname.':'.$udom} = $results->{$uname}; |
$inst_response{$uname.':'.$udom} = $outcome; |
|
$inst_results->{$uname.':'.$udom} = $results->{$uname}; |
|
} |
} |
} |
} |
} |
} |
} |
Line 9819 sub user_rule_check {
|
Line 9835 sub user_rule_check {
|
foreach my $udom (keys(%by_username)) { |
foreach my $udom (keys(%by_username)) { |
my ($outcome,$results) = &Apache::lonnet::get_multiple_instusers($udom,$by_username{$udom}); |
my ($outcome,$results) = &Apache::lonnet::get_multiple_instusers($udom,$by_username{$udom}); |
if ($outcome eq 'ok') { |
if ($outcome eq 'ok') { |
|
foreach my $uname (keys(%{$by_username{$udom}})) { |
|
$inst_response{$uname.':'.$udom} = $outcome; |
|
} |
if (ref($results) eq 'HASH') { |
if (ref($results) eq 'HASH') { |
foreach my $uname (keys(%{$results})) { |
foreach my $uname (keys(%{$results})) { |
$inst_response{$uname.':'.$udom} = $outcome; |
|
$inst_results->{$uname.':'.$udom} = $results->{$uname}; |
$inst_results->{$uname.':'.$udom} = $results->{$uname}; |
} |
} |
} |
} |
Line 9876 sub user_rule_check {
|
Line 9894 sub user_rule_check {
|
my ($uname,$udom) = split(/:/,$user); |
my ($uname,$udom) = split(/:/,$user); |
next if (($udom eq '') || ($uname eq '')); |
next if (($udom eq '') || ($uname eq '')); |
my $id; |
my $id; |
if (ref($usershash->{$user})) { |
if (ref($inst_results) eq 'HASH') { |
$id = $usershash->{$user}->{'id'}; |
if (ref($inst_results->{$user}) eq 'HASH') { |
|
$id = $inst_results->{$user}->{'id'}; |
|
} |
|
} |
|
if ($id eq '') { |
|
if (ref($usershash->{$user})) { |
|
$id = $usershash->{$user}->{'id'}; |
|
} |
} |
} |
foreach my $item (keys(%{$checks})) { |
foreach my $item (keys(%{$checks})) { |
if (ref($$curr_rules{$udom}) eq 'HASH') { |
if (ref($$curr_rules{$udom}) eq 'HASH') { |
Line 9893 sub user_rule_check {
|
Line 9918 sub user_rule_check {
|
if (ref($inst_results->{$user}) eq 'HASH') { |
if (ref($inst_results->{$user}) eq 'HASH') { |
if (keys(%{$inst_results->{$user}}) == 0) { |
if (keys(%{$inst_results->{$user}}) == 0) { |
$$alerts{$item}{$udom}{$uname} = 1; |
$$alerts{$item}{$udom}{$uname} = 1; |
|
} elsif ($item eq 'id') { |
|
if ($inst_results->{$user}->{'id'} eq '') { |
|
$$alerts{$item}{$udom}{$uname} = 1; |
|
} |
} |
} |
} |
} |
} |
} |