Module: tools Branch: master Commit: 5e371818f866e5f7958108d49502574161841680 URL: https://source.winehq.org/git/tools.git/?a=commit;h=5e371818f866e5f7958108d4...
Author: Francois Gouget fgouget@codeweavers.com Date: Thu Dec 5 10:39:48 2019 +0100
testbot/web: Abuse the Status field to show more details about accounts.
This allows quickly identifying accounts that have been approved but where the user did not pick a password.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/web/WineTestBot.css | 8 +++++++ testbot/web/admin/UsersList.pl | 47 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+)
diff --git a/testbot/web/WineTestBot.css b/testbot/web/WineTestBot.css index 1456036..f588355 100644 --- a/testbot/web/WineTestBot.css +++ b/testbot/web/WineTestBot.css @@ -387,6 +387,14 @@ pre .boterror { color: #e55600; } .canceled { color: black; }
+.userrequest { color: #e55600; } +.userapproved { color: green; } +.useradmin { color: black; } +.userdevel { color: black; } +.usernone { color: red; } +.userdisabled { color: red; } +.userdeleted { color: red; } + .log-info { background-color: #d9ffcc; } .log-skip { color: blue; } .log-todo { color: #d08000; } diff --git a/testbot/web/admin/UsersList.pl b/testbot/web/admin/UsersList.pl index f46949d..2799070 100644 --- a/testbot/web/admin/UsersList.pl +++ b/testbot/web/admin/UsersList.pl @@ -25,6 +25,7 @@ package UsersListPage; use ObjectModel::CGI::CollectionPage; our @ISA = qw(ObjectModel::CGI::CollectionPage);
+use URI::Escape; use WineTestBot::CGI::Sessions; use WineTestBot::Config; use WineTestBot::Users; @@ -55,6 +56,52 @@ sub DisplayProperty($$$) $PropertyName eq "Status" || $PropertyName eq "RealName"; }
+sub GenerateDataCell($$$$$) +{ + my ($self, $CollectionBlock, $Item, $PropertyDescriptor, $DetailsPage) = @_; + + my $PropertyName = $PropertyDescriptor->GetName(); + if ($PropertyName eq "Status") + { + my $Status = $Item->Status; + my ($Class, $Label); + if ($Status eq "disabled") + { + ($Class, $Label) = ('userdisabled', 'disabled'); + } + elsif ($Status eq "deleted") + { + ($Class, $Label) = ('userdeleted', 'deleted'); + } + elsif ($Item->WaitingForApproval()) + { + ($Class, $Label) = ('userrequest', 'request'); + } + elsif (!$Item->Activated()) + { + ($Class, $Label) = ('userapproved', 'approved'); + } + elsif ($Item->HasRole("admin")) + { + ($Class, $Label) = ('useradmin', 'admin'); + } + elsif ($Item->HasRole("wine-devel")) + { + ($Class, $Label) = ('userdevel', 'wine-devel'); + } + else + { + ($Class, $Label) = ('usernone', 'none'); + } + print "<td><a href='/admin/UserDetails.pl?Key=", uri_escape($Item->GetKey()), + "'><span class='$Class'>$Label</span></a></td>"; + } + else + { + $self->SUPER::GenerateDataCell($CollectionBlock, $Item, $PropertyDescriptor, $DetailsPage); + } +} + sub GetActions($$) { my ($self, $CollectionBlock) = @_;