Module: tools Branch: master Commit: e92578b7804177c3af9b9954781eb685d3c8bcc8 URL: http://source.winehq.org/git/tools.git/?a=commit;h=e92578b7804177c3af9b99547...
Author: Francois Gouget fgouget@codeweavers.com Date: Thu Apr 4 12:29:44 2013 +0200
testbot/Users: Add a 'Reject' button for accounts waiting for approval.
---
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();