[3/3] testbot/Users: Add a 'Reject' button for accounts waiting for approval.
Francois Gouget
fgouget at codeweavers.com
Thu Apr 4 05:29:44 CDT 2013
---
For bug 33234 - Improve user management
http://bugs.winehq.org/show_bug.cgi?id=33234
testbot/README | 4 ++--
testbot/web/admin/UserDetails.pl | 20 +++++++++++++++++++-
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/testbot/README b/testbot/README
index 7ddaba9..3977c5d 100644
--- a/testbot/README
+++ b/testbot/README
@@ -78,8 +78,8 @@ but has to be 'activated' before it can be used. Also an email is sent to the
WineTestBot administrators.
If the request is considered to be illegitimate / spam, the administrator
-should directly delete the provisional account. Otherwise the account should
-be approved.
+should directly delete / reject the provisional account. Otherwise the account
+should be approved.
Approving the account will generate a 'password reset code' and send an email
to the user with a URL to visit to set the account password. That will activate
diff --git a/testbot/web/admin/UserDetails.pl b/testbot/web/admin/UserDetails.pl
index f9c1bea..faf8bbd 100644
--- a/testbot/web/admin/UserDetails.pl
+++ b/testbot/web/admin/UserDetails.pl
@@ -57,7 +57,8 @@ sub GetActions
my @Actions;
if (!defined $LDAPServer and $self->{Item}->WaitingForApproval())
{
- $Actions[0] = "Approve";
+ push @Actions, "Approve";
+ push @Actions, "Reject" if ($self->{Item}->Name);
}
push(@Actions, @{$self->SUPER::GetActions()});
@@ -76,6 +77,19 @@ sub OnApprove($)
exit;
}
+sub OnReject($)
+{
+ my $self = shift;
+
+ $self->{Item}->Status('deleted');
+ ($self->{ErrField}, $self->{ErrMessage}) = $self->{Item}->Save();
+ return !1 if (defined $self->{ErrMessage});
+ # Forcefully log out that user by deleting his web sessions
+ DeleteSessions($self->{Item});
+ $self->RedirectToList();
+ exit;
+}
+
sub OnOK($)
{
my $self = shift;
@@ -99,6 +113,10 @@ sub OnAction
{
return $self->OnApprove();
}
+ elsif ($Action eq "Reject")
+ {
+ return $self->OnReject();
+ }
elsif ($Action eq "OK")
{
return $self->OnOK();
--
1.7.10.4
More information about the wine-patches
mailing list