#32 Check if the requestor is part of the any FAS groups
Merged 4 years ago by mohanboddu. Opened 4 years ago by mohanboddu.
mohanboddu/fedscm-admin fas-groups  into  master

file modified
+14 -3
@@ -550,14 +550,25 @@ 

      issue_owner = issue_json['user']['name']

      issue_ui_url = fedscm_admin.pagure.get_pagure_issue_url(issue_id)

  

-     # Check if the branch requestor is one of the maintainers

+     # Check if the branch requestor is one of the maintainers or part of the groups

      click.echo('- Checking if {0} is one of the maintainers of the package'.format(issue_owner))

      if force:

          msg = '    WARNING:          Checking of maintainers is skipped'

          click.secho(msg, fg='yellow')

      else:

-         maintainers = set(project['access_users']['owner']) | set(project['access_users']['admin'])

-         if issue_owner not in maintainers:

+         # Get the list of maintainers of the package

+         maintainers = set(project['access_users']['owner']) | set(project['access_users']['admin'])\

+             | set(project['access_users']['commit'])

+         # Get the list of FAS groups who can maintain the package

+         access_groups = set(project['access_groups']['admin'])\

+             | set(project['access_groups']['commit'])

+         group_member = False

+         for access_group in access_groups:

+             # Check if the requestor is part of any of the FAS groups who can maintain the package

+             if FAS_CLIENT.user_member_of(FAS_CLIENT.get_fas_user(issue_owner), access_group):

+                 group_member = True

+                 break

+         if issue_owner not in maintainers and not group_member:

              prompt_to_close_bad_ticket(

                  issue_json, '{0} is not a maintainer of the {1} package'.format(issue_owner, repo)

              )

Also, adding the check for commit acls

Signed-off-by: Mohan Boddu mboddu@bhujji.com

rebased onto b25e837

4 years ago

This looks good to me.
+1

Pull-Request has been merged by mohanboddu

4 years ago
Metadata