[PATCH] testbot/web: Abuse the Status field to show more details about accounts.

Francois Gouget fgouget at codeweavers.com
Thu Dec 5 03:39:48 CST 2019


This allows quickly identifying accounts that have been approved but
where the user did not pick a password.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 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 1456036c0..f58835583 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 f46949d24..279907041 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) = @_;
-- 
2.20.1



More information about the wine-devel mailing list