]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1232190: FlagType.create should require the user to be logged in
authorFrédéric Buclin <LpSolit@gmail.com>
Fri, 18 Dec 2015 11:52:18 +0000 (12:52 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Fri, 18 Dec 2015 11:52:18 +0000 (12:52 +0100)
r=dkl

Bugzilla/API/1_0/Resource/FlagType.pm
Bugzilla/WebService/FlagType.pm

index 702b4d4ec7c082cdbb0f44111a91737db7ba89f4..969a59532659e21c9091745e2ea0037be989fcc4 100644 (file)
@@ -114,11 +114,9 @@ sub get {
 
 sub create {
     my ($self, $params) = @_;
+    my $user = Bugzilla->login(LOGIN_REQUIRED);
 
-    my $dbh = Bugzilla->dbh;
-    my $user = Bugzilla->user;
-
-    Bugzilla->user->in_group('editcomponents')
+    $user->in_group('editcomponents')
         || scalar(@{$user->get_products_by_permission('editcomponents')})
         || ThrowUserError("auth_failure", { group => "editcomponents",
                                          action => "add",
@@ -174,11 +172,9 @@ sub create {
 
 sub update {
     my ($self, $params) = @_;
-
     my $dbh = Bugzilla->dbh;
-    my $user = Bugzilla->user;
+    my $user = Bugzilla->login(LOGIN_REQUIRED);
 
-    Bugzilla->login(LOGIN_REQUIRED);
     $user->in_group('editcomponents')
         || scalar(@{$user->get_products_by_permission('editcomponents')})
         || ThrowUserError("auth_failure", { group  => "editcomponents",
index 9723d47358d1fce861d526f0d82eed0f145c126d..9d7cce0375a69bbb77a0b762f23a6e3861aae397 100644 (file)
@@ -61,11 +61,9 @@ sub get {
 
 sub create {
     my ($self, $params) = @_;
+    my $user = Bugzilla->login(LOGIN_REQUIRED);
 
-    my $dbh = Bugzilla->dbh;
-    my $user = Bugzilla->user;
-
-    Bugzilla->user->in_group('editcomponents')
+    $user->in_group('editcomponents')
         || scalar(@{$user->get_products_by_permission('editcomponents')})
         || ThrowUserError("auth_failure", { group => "editcomponents",
                                          action => "add",
@@ -121,11 +119,9 @@ sub create {
 
 sub update {
     my ($self, $params) = @_;
-
     my $dbh = Bugzilla->dbh;
-    my $user = Bugzilla->user;
+    my $user = Bugzilla->login(LOGIN_REQUIRED);
 
-    Bugzilla->login(LOGIN_REQUIRED);
     $user->in_group('editcomponents')
         || scalar(@{$user->get_products_by_permission('editcomponents')})
         || ThrowUserError("auth_failure", { group  => "editcomponents",