sub DoOtherRequest { ... } elsif ($action eq "trimusers") { &DoTrimUsers(); + } elsif ($action eq 'role') { + &DoRole(); } else { &ReportError(Ts('Invalid action parameter %s', $action)); ... } + sub LoadUserDataById {# from UseMod WikiPatches/UserList + my ($id) = @_; + my ($data, $status, %userdata); + + %userdata = (); + ($status, $data) = &ReadFile(&UserDataFilename($id)); + if ($status) { + %userdata = split(/$FS1/, $data, -1); # -1 keeps trailing null fields + } + return %userdata; +} + +sub DoRole { + my ($action, %userdata); + my ($dupla, $c, $auth, $data, %v, %t, @unsorted, @sorted); + my $i; + + $i = 0; + for ($i= 1001; ; ++$i) { + %userdata = &LoadUserDataById($i); + last unless scalar %userdata; + if ($userdata{username}) { + if ($userdata{'adminpw'} eq $AdminPass) { $t{$c} = 'Admin';} + if ($userdata{'adminpw'} eq $EditPass) { $t{$c} = 'Edit';} + if (!$userdata{'adminpw'}) { $t{$c} = 'User';} + $v{$c} = &GetPageOrEditLink($userdata{username}); + $dupla = "$t{$c}|$v{$c}"; + push(@unsorted, $dupla); + @sorted = sort @unsorted; + } + } + print &GetHeader('', Ts('Role'), ''); + print '<ol>'; + foreach $c (@sorted) { + ($data, $auth) = split(/\|/,$c); # $dupla = "$t{$c}|$v{$c}"; + print '<li>' . $auth . ': ' . $data; + } + print '</ol>'; + print &GetCommonFooter(); +}--JuanmaMP