#38 Fix users check against packagers group
Merged 3 years ago by ignatenkobrain. Opened 3 years ago by mattia.
mattia/fedscm-admin fas_check  into  master

file modified
+14 -4
@@ -161,16 +161,26 @@ 

                  if flag.get('status') == '+':

                      flag_set = True

                  if check_fas and require_auth:

-                     fas_user = self.get_fas_user_by_bz_email(bug.creator)

-                     if not fas_user:

+                     fas_reviewer = self.get_fas_user_by_bz_email(bug.assigned_to)

+                     if not fas_reviewer:

                          raise ValidationError(

                              'The email address "{0}" of the Bugzilla reviewer '

                              'is not tied to a user in FAS. Group membership '

-                             'can\'t be validated.'.format(flag['setter']))

-                     if not FAS_CLIENT.user_member_of(fas_user, 'packager'):

+                             'can\'t be validated.'.format(bug.assigned_to))

+                     if not FAS_CLIENT.user_member_of(fas_reviewer, 'packager'):

                          raise ValidationError('The Bugzilla bug\'s review '

                                                'is approved by a user that is '

                                                'not a packager')

+                     fas_submitter = self.get_fas_user_by_bz_email(bug.creator)

+                     if not fas_submitter:

+                         raise ValidationError(

+                             'The email address "{0}" of the Bugzilla submitter '

+                             'is not tied to a user in FAS. Group membership '

+                             'can\'t be validated.'.format(bug.creator))

+                     if not FAS_CLIENT.user_member_of(fas_submitter, 'packager'):

+                         raise ValidationError('The Bugzilla bug\'s review '

+                                               'is submitted by a user that is '

+                                               'not a packager')

                  # Setter will be an empty string and emails will not be shown

                  # if the user is not logged in. This is why we check for

                  # authentication here.

The current check about the reviewer to be member of the packager group is wrong, the check is performed against the submitter.

This PR will make fedscm-admin to check both the submitter and the reviewer to be approved packagers or display the right error message.
See https://pagure.io/releng/issue/9579

Signed-off-by: Mattia Verga mattia.verga@protonmail.com

Pull-Request has been merged by ignatenkobrain

3 years ago
Metadata