Ë
    ÇVh  ã                   óv   — d dl mZmZmZ eZddgddœZdZdZdZ	d d	l
mZ d d
lmZmZmZ d„ Zedk(  r e«        yy)é    )Úabsolute_importÚdivisionÚprint_functionz1.1ÚpreviewÚ	community)Úmetadata_versionÚstatusÚsupported_byaç  
---
module: mso_user
short_description: Manage users
description:
- Manage users on Cisco ACI Multi-Site.
author:
- Dag Wieers (@dagwieers)
options:
  user:
    description:
    - The name of the user.
    type: str
    aliases: [ name ]
  user_password:
    description:
    - The password of the user.
    type: str
  first_name:
    description:
    - The first name of the user.
    - This parameter is required when creating new users.
    type: str
  last_name:
    description:
    - The last name of the user.
    - This parameter is required when creating new users.
    type: str
  email:
    description:
    - The email address of the user.
    - This parameter is required when creating new users.
    type: str
  phone:
    description:
    - The phone number of the user.
    - This parameter is required when creating new users.
    type: str
  account_status:
    description:
    - The status of the user account.
    type: str
    choices: [ active, inactive ]
  domain:
    description:
    - The domain this user belongs to.
    - When creating new users, this defaults to C(Local).
    type: str
  roles:
    description:
    - The roles for this user and their access types (read or write).
    - Access type defaults to C(write).
    type: list
    elements: str
  state:
    description:
    - Use C(present) or C(absent) for adding or removing.
    - Use C(query) for listing an object or multiple objects.
    type: str
    choices: [ absent, present, query ]
    default: present
notes:
- A default installation of ACI Multi-Site ships with admin password 'we1come!' which requires a password change on first login.
  See the examples of how to change the 'admin' password using Ansible.
extends_documentation_fragment: cisco.mso.modules
aÎ  
- name: Update initial admin password
  cisco.mso.mso_user:
    host: mso_host
    username: admin
    password: initialPassword
    validate_certs: false
    user: admin
    user_password: newPassword
    state: present

- name: Add a new user
  cisco.mso.mso_user:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    validate_certs: false
    user: dag
    user_password: userPassword
    first_name: Dag
    last_name: Wieers
    email: dag@wieers.com
    phone: +32 478 436 299
    roles:
      - name: siteManager
        access_type: write
      - name: schemaManager
        access_type: read
    state: present

- name: Add a new user
  cisco.mso.mso_user:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    validate_certs: false
    user: dag
    first_name: Dag
    last_name: Wieers
    email: dag@wieers.com
    phone: +32 478 436 299
    roles:
      - powerUser

- name: Remove a user
  cisco.mso.mso_user:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    validate_certs: false
    user: dag
    state: absent

- name: Query a user
  cisco.mso.mso_user:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    validate_certs: false
    user: dag
    state: query
  register: query_result

- name: Query all users
  cisco.mso.mso_user:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    validate_certs: false
    state: query
  register: query_result
z # )ÚAnsibleModule)Ú	MSOModuleÚmso_argument_specÚissubsetc                  óÔ	  — t        «       } | j                  t        ddg¬«      t        dd¬«      t        d¬«      t        d¬«      t        d¬«      t        d¬«      t        dddg¬	«      t        d¬«      t        d
d¬«      t        ddg d¢¬«      ¬«
       t        | ddddggdddggg¬«      }|j                  j                  d«      }|j                  j                  d«      }|j                  j                  d«      }|j                  j                  d«      }|j                  j                  d«      }|j                  j                  d«      }|j                  j                  d«      }|j                  j                  d«      }	t        |«      }
|
j                  |j                  j                  d«      «      }|
j                  |j                  j                  d«      «      }d }d}|rû|
j                  j                  r“|
j                  j                  «       dk(  rv|
j                  ||d¬«      |
_        |
j                  ri|
j                  j                  d «      |
j                  d!<   |
j                  j                  d"«      |
j                  d#<   n|
j                  ||¬$«      |
_        |
j                  rD|
j                  j                  d!«      }d%j                  |¬&«      }n|
j!                  |«      |
_        |	d'k(  rn×|	dk(  rM|
j                  |
_        |
j                  r´|j$                  r	i |
_        nŸ|
j'                  |d(¬)«      |
_        n…|	dk(  r|
j                  |
_        t        |||||||||¬*«	      }||j                  |¬+«       |
j)                  |d¬,«       |
j*                  j                  d-«      €d|
j*                  d-<   |
j                  ršt-        |
j*                  |
j                  «      sÝd.|
j.                  v r*|
j                  j1                  d/«       d|
j2                  d0<   |j$                  r|
j.                  |
_        n‡|
j'                  |d1|
j*                  ¬2«      |
_        nc|€ |
j5                  d3j                  |«      «       |j$                  r|
j.                  |
_        n#|
j'                  |d4|
j*                  ¬2«      |
_        |
j7                  «        y )5NÚstrÚname)ÚtypeÚaliasesT)r   Úno_log)r   ÚactiveÚinactive)r   ÚchoicesÚlist)r   ÚelementsÚpresent)Úabsentr   Úquery)r   Údefaultr   )
ÚuserÚuser_passwordÚ
first_nameÚ	last_nameÚemailÚphoneÚaccount_statusÚdomainÚrolesÚstater'   r   r   )Úargument_specÚsupports_check_modeÚrequired_ifr   r    r!   r"   r#   r$   r&   r%   Úuserszcisco.ndÚv2)ÚloginIDÚapi_versionÚuserIDÚidr-   Úusername)r1   z
users/{id})r0   r   ÚDELETE)Úmethod)	r0   r1   Ú	firstNameÚlastNameÚemailAddressÚphoneNumberÚaccountStatusÚdomainIdr&   )Úpassword)Úcollater8   r:   z[A password change is assumed, as the MSO REST API does not return passwords we do not know.ÚchangedÚPUT)r3   Údataz\The user {0} does not exist. The 'user_password' attribute is required to create a new user.ÚPOST)r   ÚupdateÚdictr   ÚparamsÚgetr   Úlookup_rolesÚlookup_domainÚmoduleÚ_socket_pathÚ
connectionÚget_platformÚget_objÚexistingÚformatÚ
query_objsÚpreviousÚ
check_modeÚrequestÚsanitizeÚsentr   ÚproposedÚwarnÚresultÚ	fail_jsonÚ	exit_json)r(   rF   Ú	user_namer   r    r!   r"   r#   r$   r'   Úmsor&   r%   Úuser_idÚpathÚpayloads                   úf/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/cisco/mso/plugins/modules/mso_user.pyÚmainr^   Ÿ   s  € Ü%Ó'€MØ×ÑÜu v hÔ/Ü ¨dÔ3Ü˜UÔ#Ü˜EÔ"Ü˜ÔÜ˜Ôä °¸:Ð0FÔGÜ˜ÔÜ˜¨Ô/Ü˜ yÒ:XÔYð ô ô Ø#Ø àh  Ð)Øi & Ð*ð
ô€Fð —‘×!Ñ! &Ó)€IØ—M‘M×%Ñ% oÓ6€MØ—‘×"Ñ" <Ó0€JØ—‘×!Ñ! +Ó.€IØM‰M×Ñ˜gÓ&€EØM‰M×Ñ˜gÓ&€EØ—]‘]×&Ñ&Ð'7Ó8€NØM‰M×Ñ˜gÓ&€Eä
FÓ
€Cà×Ñ˜VŸ]™]×.Ñ.¨wÓ7Ó8€EØ×Ñ˜vŸ}™}×0Ñ0°Ó:Ó;€Fà€GØ€Dñ Ø:‰:×"Ò" s§~¡~×'BÑ'BÓ'DÈ
Ò'RØŸ;™; t°YÈD˜;ÓQˆCŒLØ|Š|Ø%(§\¡\×%5Ñ%5°hÓ%?—‘˜TÑ"Ø+.¯<©<×+;Ñ+;¸IÓ+F—‘˜ZÒ(àŸ;™; t°i˜;Ó@ˆCŒLØ<Š<Ø—l‘l×&Ñ& tÓ,ˆGà×&Ñ&¨'Ð&Ó2‰Dà—~‘~ dÓ+ˆŒàÒÙà	(Ò	Ø—|‘|ˆŒØ<‹<Ø× Ò Ø!–à"Ÿ{™{¨4¸˜{ÓA–à	)Ó	Ø—|‘|ˆŒäØØØ ØØØØ(ØØô
ˆð Ð$ØN‰N MˆNÔ2à‰W dˆÔ+à8‰8<‰<˜Ó(Ð0Ø(0ˆCH‰H_Ñ%à<Š<Ü˜CŸH™H c§l¡lÔ3à §¡Ñ-Ø—J‘J—O‘Oð  %Bô  CØ,0C—J‘J˜yÑ)à×$Ò$Ø#&§<¡<C•Là#&§;¡;¨t¸EÈÏÉ ;Ó#QC•Lð Ð$Ø—‘Ð|÷  Dñ  Dð  ENó  Oô  PØ× Ò Ø"Ÿ|™|•à"Ÿ{™{¨4¸ÀSÇXÁX˜{ÓN”à‡MM…Oó    Ú__main__N)Ú
__future__r   r   r   r   Ú__metaclass__ÚANSIBLE_METADATAÚDOCUMENTATIONÚEXAMPLESÚRETURNÚansible.module_utils.basicr   Ú6ansible_collections.cisco.mso.plugins.module_utils.msor   r   r   r^   Ú__name__© r_   r]   ú<module>rk      s`   ð÷ AÑ @à€à(-¸)¸ÐVaÑbÐ ðA€ðFG€ðR 
€å 4ß iÑ iòrðj ˆzÒÙ…Fð r_   