Ë
    ÇVhÐ  ã                   óN   — d Z dZddlmZ  G d„ de«      Zd„ Zedk(  r e«        yy)	aT  
---
module: role_assignment
short_description: Assign OpenStack identity groups and users to roles
author: OpenStack Ansible SIG
description:
  - Grant and revoke roles in either project or domain context for
    OpenStack identity (Keystone) users and groups.
options:
  domain:
    description:
      - Name or ID of the domain to scope the role association to.
      - Valid only with keystone version 3.
      - Required if I(project) is not specified.
      - When I(project) is specified, then I(domain) will not be used for
        scoping the role association, only for finding resources.
      - "When scoping the role association, I(project) has precedence over
         I(domain) and I(domain) has precedence over I(system): When I(project)
         is specified, then I(domain) and I(system) are not used for role
         association. When I(domain) is specified, then I(system) will not be
         used for role association."
    type: str
  group:
    description:
      - Name or ID for the group.
      - Valid only with keystone version 3.
      - If I(group) is not specified, then I(user) is required. Both may not be
        specified at the same time.
    type: str
  project:
    description:
      - Name or ID of the project to scope the role association to.
      - If you are using keystone version 2, then this value is required.
      - When I(project) is specified, then I(domain) will not be used for
        scoping the role association, only for finding resources.
      - "When scoping the role association, I(project) has precedence over
         I(domain) and I(domain) has precedence over I(system): When I(project)
         is specified, then I(domain) and I(system) are not used for role
         association. When I(domain) is specified, then I(system) will not be
         used for role association."
    type: str
  role:
    description:
      - Name or ID for the role.
    required: true
    type: str
  state:
    description:
      - Should the roles be present or absent on the user.
    choices: [present, absent]
    default: present
    type: str
  system:
    description:
      - Name of system to scope the role association to.
      - Valid only with keystone version 3.
      - Required if I(project) and I(domain) are not specified.
      - "When scoping the role association, I(project) has precedence over
         I(domain) and I(domain) has precedence over I(system): When I(project)
         is specified, then I(domain) and I(system) are not used for role
         association. When I(domain) is specified, then I(system) will not be
         used for role association."
    type: str
  user:
    description:
      - Name or ID for the user.
      - If I(user) is not specified, then I(group) is required. Both may not be
        specified at the same time.
    type: str
extends_documentation_fragment:
  - openstack.cloud.openstack
az  
- name: Grant an admin role on the user admin in the project project1
  openstack.cloud.role_assignment:
    cloud: mycloud
    user: admin
    role: admin
    project: project1

- name: Revoke the admin role from the user barney in the newyork domain
  openstack.cloud.role_assignment:
    cloud: mycloud
    state: absent
    user: barney
    role: admin
    domain: newyork
é    )ÚOpenStackModulec                   óœ   — e Zd Z e e«        e«        e«        ed¬«       edddg¬«       e«        e«       ¬«      Z eddgd¬	«      Zd
„ Zy)ÚIdentityRoleAssignmentModuleT)ÚrequiredÚpresentÚabsent)ÚdefaultÚchoices)ÚdomainÚgroupÚprojectÚroleÚstateÚsystemÚuser)r   r   )r   r   r   )Úrequired_one_ofÚsupports_check_modec                 ól  — i }i }i }| j                   d   }| j                  j                  j                  |d¬«      }|d   |d<   | j                   d   }|?| j                  j                  j	                  |d¬«      }|d   |d<   |d   |d<   |d   |d<   | j                   d	   }|9 | j                  j                  j
                  |fd
di|¤Ž}	|	d   |d<   |	d   |d	<   | j                   d   }
|
9 | j                  j                  j                  |
fd
di|¤Ž}|d   |d<   |d   |d<   | j                   d   }|d|vr||d<   ||d<   | j                   d   }|] | j                  j                  j                  |fd
di|¤Ž}|d   |d<   |d   |d<   |j                  dd «       |j                  dd «       t         | j                  j                  j                  di |¤Ž«      }| j                   d   }| j                  j                  r%| j                  |dk(  xr | xs	 |dk(  xr |¬«       |dk(  r5|s3 | j                  j                  |d   fi |¤Ž | j                  d¬«       y |dk(  r5|r3 | j                  j                  |d   fi |¤Ž | j                  d¬«       y | j                  d¬«       y )Nr   F)Úignore_missingÚidÚrole_idr   Úscope_domain_idÚ	domain_idr   r   Úuser_idr   Úgroup_idr   zscope.systemr   Úscope_project_idr   r   r   )ÚchangedT© )ÚparamsÚconnÚidentityÚ	find_roleÚfind_domainÚ	find_userÚ
find_groupÚfind_projectÚpopÚlistÚrole_assignmentsÚansibleÚ
check_modeÚ	exit_jsonÚ
grant_roleÚrevoke_role)ÚselfÚfiltersÚfind_filtersÚkwargsÚrole_name_or_idr   Údomain_name_or_idr   Úuser_name_or_idr   Úgroup_name_or_idr   Úsystem_nameÚproject_name_or_idr   r)   r   s                    ús/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/openstack/cloud/plugins/modules/role_assignment.pyÚrunz IdentityRoleAssignmentModule.runw   s   € ØˆØˆØˆàŸ+™+ fÑ-ˆØy‰y×!Ñ!×+Ñ+¨OØ;@ð ,ó Bˆà! $™Zˆ	Ñà ŸK™K¨Ñ1ÐØÐ(Ø—Y‘Y×'Ñ'×3Ñ3Ø!°%ð 4ó 9ˆFà)/°©ˆGÐ%Ñ&Ø(.¨t©ˆL˜Ñ%Ø% d™|ˆF8ÑàŸ+™+ fÑ-ˆØÐ&Ø/4—9‘9×%Ñ%×/Ñ/ØñGØ05ðGØ9EñGˆDà!% d¡ˆGIÑØ! $™ZˆF6‰NàŸ;™; wÑ/ÐØÐ'Ø1D—I‘I×&Ñ&×1Ñ1Ø ñHØ16ðHØ:FñHˆEà"'¨¡+ˆGJÑØ# D™kˆF7‰Oà—k‘k (Ñ+ˆØÐ"à ¨Ñ/Ø*5˜Ñ'à*ˆF8Ñà!Ÿ[™[¨Ñ3ÐØÐ)Ø5d—i‘i×(Ñ(×5Ñ5Ø"ñJØ38ðJØ<HñJˆGà*1°$©-ˆGÐ&Ñ'Ø '¨¡ˆF9Ñð K‰KÐ)¨4Ô0ØK‰K˜¨Ô-äÐ C §	¡	× 2Ñ 2× CÑ CÑ NÀgÑ NÓOÐà—‘˜GÑ$ˆØ<‰<×"Ò"ØN‰NØ 9Ñ,ÒEÐ5EÐ1Eò EØ" hÑ.ÒCÐ3Cð ô Gð IÒÑ&6Ø ˆDI‰I× Ñ   d¡Ñ6¨vÒ6ØN‰N 4ˆNÕ(ØhÒÑ#3Ø!ˆDI‰I×!Ñ! $ t¡*Ñ7°Ò7ØN‰N 4ˆNÕ(àN‰N 5ˆNÕ)ó    N)Ú__name__Ú
__module__Ú__qualname__ÚdictÚargument_specÚmodule_kwargsr:   r   r;   r9   r   r   d   s^   „ ÙÙ‹vÙ‹fÙ“Ù˜4Ô Ù˜9¨x¸Ð.CÔDÙ‹vÙ‹Vô€Mñ àØ+ð
ð !ô€MóB*r;   r   c                  ó&   — t        «       }  | «        y )N)r   )Úmodules    r9   ÚmainrD   ¼   s   € Ü)Ó+€FÙ
…Hr;   Ú__main__N)ÚDOCUMENTATIONÚEXAMPLESÚBansible_collections.openstack.cloud.plugins.module_utils.openstackr   r   rD   r<   r   r;   r9   ú<module>rI      sC   ððG€ðR€õ" _ôU* ?ô U*òpð
 ˆzÒÙ…Fð r;   