From 6f3e5c8018709ef5a43427c5259e24372eefe7c3 Mon Sep 17 00:00:00 2001 From: "terry%netscape.com" <> Date: Fri, 12 Mar 1999 00:30:51 +0000 Subject: Added 'groups' stuff, where we have different group bits that we can put on a person or on a bug. Some of the group bits control access to bugzilla features. And a person can't access a bug unless he has every group bit set that is also set on the bug. --- CGI.pl | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) (limited to 'CGI.pl') diff --git a/CGI.pl b/CGI.pl index f16640bc1..3f3ed82b4 100644 --- a/CGI.pl +++ b/CGI.pl @@ -231,6 +231,35 @@ sub PasswordForLogin { return $result; } + +sub quietly_check_login() { + $::usergroupset = '0'; + my $loginok = 0; + if (defined $::COOKIE{"Bugzilla_login"} && + defined $::COOKIE{"Bugzilla_logincookie"}) { + ConnectToDatabase(); + SendSQL("select profiles.groupset, profiles.login_name = " . + SqlQuote($::COOKIE{"Bugzilla_login"}) . + " and profiles.cryptpassword = logincookies.cryptpassword " . + "and logincookies.hostname = " . + SqlQuote($ENV{"REMOTE_HOST"}) . + " from profiles,logincookies where logincookies.cookie = " . + $::COOKIE{"Bugzilla_logincookie"} . + " and profiles.userid = logincookies.userid"); + my @row; + if (@row = FetchSQLData()) { + $loginok = $row[1]; + if ($loginok) { + $::usergroupset = $row[0]; + } + } + } + return $loginok; +} + + + + sub confirm_login { my ($nexturl) = (@_); @@ -324,25 +353,9 @@ To use the wonders of bugzilla, you can use the following: } - my $loginok = 0; - - if (defined $::COOKIE{"Bugzilla_login"} && - defined $::COOKIE{"Bugzilla_logincookie"}) { - SendSQL("select profiles.login_name = " . - SqlQuote($::COOKIE{"Bugzilla_login"}) . - " and profiles.cryptpassword = logincookies.cryptpassword " . - "and logincookies.hostname = " . - SqlQuote($ENV{"REMOTE_HOST"}) . - " from profiles,logincookies where logincookies.cookie = " . - $::COOKIE{"Bugzilla_logincookie"} . - " and profiles.userid = logincookies.userid"); - $loginok = FetchOneColumn(); - if (!defined $loginok) { - $loginok = 0; - } - } + my $loginok = quietly_check_login(); - if ($loginok ne "1") { + if ($loginok != 1) { print "Content-type: text/html\n\n"; print "

Please log in.

\n"; print "I need a legitimate e-mail address and password to continue.\n"; -- cgit v1.2.3-24-g4f1b