Francois Gouget : testbot/cgi: In case of insufficient privileges redirect to the main page.

Alexandre Julliard julliard at winehq.org
Thu May 19 16:11:13 CDT 2022


Module: tools
Branch: master
Commit: 22baa974532565ff19effa4acf39b930556c8da2
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=22baa974532565ff19effa4acf39b930556c8da2

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu May 19 19:13:58 2022 +0200

testbot/cgi: In case of insufficient privileges redirect to the main page.

There is no point asking already logged in users to log in again if they
don't have enough privileges.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/lib/WineTestBot/CGI/PageBase.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/testbot/lib/WineTestBot/CGI/PageBase.pm b/testbot/lib/WineTestBot/CGI/PageBase.pm
index a4d1ebe..c42a4f2 100644
--- a/testbot/lib/WineTestBot/CGI/PageBase.pm
+++ b/testbot/lib/WineTestBot/CGI/PageBase.pm
@@ -88,12 +88,15 @@ sub new($$$$@)
   {
     $self->CheckSecurePage();
     my $Session = $self->GetCurrentSession();
-    if (! defined($Session) ||
-        ! $Session->User->HasRole($RequiredRole))
+    if (!defined $Session)
     {
       my $LoginURL = "/Login.pl?Target=" . uri_escape($ENV{"REQUEST_URI"});
       exit($self->Redirect(MakeSecureURL($LoginURL)));
     }
+    elsif (!$Session->User->HasRole($RequiredRole))
+    {
+      exit($self->Redirect("/"));
+    }
   }
 
   $self->_initialize(@_);




More information about the wine-cvs mailing list