]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 304696: Replace UserInGroup() by $user->in_group() when checking user privs in...
authorlpsolit%gmail.com <>
Fri, 16 Sep 2005 05:01:56 +0000 (05:01 +0000)
committerlpsolit%gmail.com <>
Fri, 16 Sep 2005 05:01:56 +0000 (05:01 +0000)
12 files changed:
doeditparams.cgi
editcomponents.cgi
editflagtypes.cgi
editgroups.cgi
editkeywords.cgi
editmilestones.cgi
editparams.cgi
editproducts.cgi
editsettings.cgi
editusers.cgi
editversions.cgi
editwhines.cgi

index cfc21e23d21c643fb7d5e7f5739a4c1b98b2d2fb..8d69f56bc2df969afb385221dabfd777ebab54ca 100755 (executable)
@@ -28,18 +28,17 @@ use lib qw(.);
 use Bugzilla;
 use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT :admin $datadir);
-use Bugzilla::User;
 
 require "globals.pl";
 
-Bugzilla->login(LOGIN_REQUIRED);
+my $user = Bugzilla->login(LOGIN_REQUIRED);
 
 my $cgi = Bugzilla->cgi;
 my $template = Bugzilla->template;
 
 print $cgi->header();
 
-UserInGroup("tweakparams")
+$user->in_group('tweakparams')
   || ThrowUserError("auth_failure", {group  => "tweakparams",
                                      action => "modify",
                                      object => "parameters"});
index 703f124c96e2a23f758978d0e5cac177eccbe278..096570d82df4d70d2ef98069186ad6b3b22bf61c 100755 (executable)
@@ -53,7 +53,7 @@ my $whoid = $user->id;
 
 print $cgi->header();
 
-UserInGroup("editcomponents")
+$user->in_group('editcomponents')
   || ThrowUserError("auth_failure", {group  => "editcomponents",
                                      action => "edit",
                                      object => "components"});
index ed3743a43d529e0035d686ff4395710c01795dce..d0c04f5c105a89bc39e55f84db2342ec76230225 100755 (executable)
@@ -37,14 +37,13 @@ use Bugzilla::Constants;
 use Bugzilla::Flag;
 use Bugzilla::FlagType;
 use Bugzilla::Group;
-use Bugzilla::User;
 use Bugzilla::Util;
 
 use vars qw( $template $vars );
 
 # Make sure the user is logged in and is an administrator.
-Bugzilla->login(LOGIN_REQUIRED);
-UserInGroup("editcomponents")
+my $user = Bugzilla->login(LOGIN_REQUIRED);
+$user->in_group('editcomponents')
   || ThrowUserError("auth_failure", {group  => "editcomponents",
                                      action => "edit",
                                      object => "flagtypes"});
index f032da7286b3ef2955dbd4b318dd7aad699de0d6..d457303f1efe272b19b5e5a17f68181fc0a610ce 100755 (executable)
@@ -31,7 +31,6 @@ use lib ".";
 
 use Bugzilla;
 use Bugzilla::Constants;
-use Bugzilla::User;
 use Bugzilla::Group;
 require "globals.pl";
 
@@ -40,11 +39,11 @@ my $dbh = Bugzilla->dbh;
 
 use vars qw($template $vars);
 
-Bugzilla->login(LOGIN_REQUIRED);
+my $user = Bugzilla->login(LOGIN_REQUIRED);
 
 print $cgi->header();
 
-UserInGroup("creategroups")
+$user->in_group('creategroups')
   || ThrowUserError("auth_failure", {group  => "creategroups",
                                      action => "edit",
                                      object => "groups"});
index bca94dba0060081502402c2cefaa3d58ad192ff9..77b8f0a22cdf1f43587458c910227d6c8bd75298 100755 (executable)
@@ -28,7 +28,6 @@ require "globals.pl";
 use Bugzilla;
 use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT $datadir);
-use Bugzilla::User;
 
 my $cgi = Bugzilla->cgi;
 my $dbh = Bugzilla->dbh;
@@ -60,11 +59,11 @@ sub Validate {
 # Preliminary checks:
 #
 
-Bugzilla->login(LOGIN_REQUIRED);
+my $user = Bugzilla->login(LOGIN_REQUIRED);
 
 print $cgi->header();
 
-UserInGroup("editkeywords")
+$user->in_group('editkeywords')
   || ThrowUserError("auth_failure", {group  => "editkeywords",
                                      action => "edit",
                                      object => "keywords"});
index 18c3f62aa06e73d03705fd8a8182fb8d0e779b54..b9c4e0d5173d14ee01dede52cc97c6d5177020f2 100755 (executable)
@@ -23,7 +23,6 @@ require "globals.pl";
 
 use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT $datadir);
-use Bugzilla::User;
 use Bugzilla::Product;
 use Bugzilla::Milestone;
 use Bugzilla::Bug;
@@ -42,7 +41,7 @@ my $whoid = $user->id;
 
 print $cgi->header();
 
-UserInGroup("editcomponents")
+$user->in_group('editcomponents')
   || ThrowUserError("auth_failure", {group  => "editcomponents",
                                      action => "edit",
                                      object => "milestones"});
index 264e991a4f73b8ec400153a1f082e1c8f7ed3826..8924a0edcffd085e2afc3ec9feb8a15ad5638668 100755 (executable)
@@ -27,17 +27,16 @@ use lib ".";
 
 use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT :admin);
-use Bugzilla::User;
 
 require "globals.pl";
 
-Bugzilla->login(LOGIN_REQUIRED);
+my $user = Bugzilla->login(LOGIN_REQUIRED);
 
 my $template = Bugzilla->template;
 
 print Bugzilla->cgi->header();
 
-UserInGroup("tweakparams")
+$user->in_group('tweakparams')
   || ThrowUserError("auth_failure", {group  => "tweakparams",
                                      action => "modify",
                                      object => "parameters"});
index 315dfd0599348549327aa501dca4ee583abd5fe7..9aadfd04a0fbbc8c5dc54b481e7f2c959ff08c35 100755 (executable)
@@ -37,7 +37,6 @@ use Bugzilla::Constants;
 require "globals.pl";
 use Bugzilla::Bug;
 use Bugzilla::Series;
-use Bugzilla::User;
 use Bugzilla::Config qw(:DEFAULT $datadir);
 
 # Shut up misguided -w warnings about "used only once".  "use vars" just
@@ -242,7 +241,7 @@ my $whoid = $user->id;
 my $cgi = Bugzilla->cgi;
 print $cgi->header();
 
-UserInGroup("editcomponents")
+$user->in_group('editcomponents')
   || ThrowUserError("auth_failure", {group  => "editcomponents",
                                      action => "edit",
                                      object => "products"});
index 742bd71766fa374e457cb8d96dbea7260ac3eca3..883666074fca51034851afe2bb321ffd94179d29 100755 (executable)
@@ -21,7 +21,6 @@ use lib qw(.);
 
 use Bugzilla;
 use Bugzilla::Constants;
-use Bugzilla::User;
 use Bugzilla::User::Setting;
 
 require "globals.pl";
@@ -69,12 +68,12 @@ sub SaveSettings{
 ###  Live code  ###
 ###################
 
-Bugzilla->login(LOGIN_REQUIRED);
+my $user = Bugzilla->login(LOGIN_REQUIRED);
 
 my $cgi = Bugzilla->cgi;
 print $cgi->header;
 
-UserInGroup("tweakparams")
+$user->in_group('tweakparams')
   || ThrowUserError("auth_failure", {group  => "tweakparams",
                                      action => "modify",
                                      object => "settings"});
index ade2f0ca7c8e067f5b714b4c0428e6d0f8fb11b3..27c16bbe72063085c6d2573d1a63f2f753ec7b56 100755 (executable)
@@ -43,7 +43,7 @@ my $editusers = $user->in_group('editusers');
 
 # Reject access if there is no sense in continuing.
 $editusers
-    || Bugzilla->user->can_bless()
+    || $user->can_bless()
     || ThrowUserError("auth_failure", {group  => "editusers",
                                        reason => "cant_bless",
                                        action => "edit",
index cf2303e5f9f1164bcb9e63bd9b3465f9ab5953b1..66e81b864b1c5ea71d26fe277017fba125c18356 100755 (executable)
@@ -35,7 +35,6 @@ require "globals.pl";
 
 use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT $datadir);
-use Bugzilla::User;
 use Bugzilla::Product;
 use Bugzilla::Version;
 
@@ -48,11 +47,11 @@ my $dbh = Bugzilla->dbh;
 # Preliminary checks:
 #
 
-Bugzilla->login(LOGIN_REQUIRED);
+my $user = Bugzilla->login(LOGIN_REQUIRED);
 
 print $cgi->header();
 
-UserInGroup("editcomponents")
+$user->in_group('editcomponents')
   || ThrowUserError("auth_failure", {group  => "editcomponents",
                                      action => "edit",
                                      object => "versions"});
index db9d082926aec7fbcdd406f9bf86549283c596f8..2b70acc139a903de3d1fe19f69bdab3ff56df7cb 100755 (executable)
@@ -36,7 +36,7 @@ use Bugzilla::Constants;
 use Bugzilla::User;
 use Bugzilla::Group;
 # require the user to have logged in
-Bugzilla->login(LOGIN_REQUIRED);
+my $user = Bugzilla->login(LOGIN_REQUIRED);
 
 ###############################################################################
 # Main Body Execution
@@ -46,7 +46,6 @@ my $cgi      = Bugzilla->cgi;
 my $template = Bugzilla->template;
 my $dbh      = Bugzilla->dbh;
 
-my $user     = Bugzilla->user;
 my $userid   = $user->id;
 
 my $sth; # database statement handle
@@ -73,7 +72,7 @@ my $sth; # database statement handle
 my $events = get_events($userid);
 
 # First see if this user may use whines
-UserInGroup("bz_canusewhines")
+$user->in_group('bz_canusewhines')
   || ThrowUserError("auth_failure", {group  => "bz_canusewhines",
                                      action => "schedule",
                                      object => "reports"});