Add the uid-/gidnumber as an argument to ipa_user (#32561)

* Adds the uid-/gidnumber as an argument to ipa_user

* Fixes issue #32555
* Adds the uidnumber which is called UID in the IPA web interface most
often, but called uidnumber in the JSON-API of IPA's `user_mod`
call.
* Adds the gidnumber which is called GID in the IPA web interface, but
called gidnumber in the JSON-API
* Code changes analogue to PR #32369

* Removed wrong version_number from telephonenumber

Remove wrongly placed version_number information

* Put arguments in different lines

Following PEP-8 the uidnumber and gidnumber are on different lines in the update method
This commit is contained in:
Julian 2017-11-05 22:53:36 +01:00 committed by René Moser
parent a8ab1a0b20
commit 55bc8291d6

View file

@ -55,6 +55,14 @@ options:
description: uid of the user description: uid of the user
required: true required: true
aliases: ["name"] aliases: ["name"]
uidnumber:
description:
- Account Settings UID/Posix User ID number
version_added: 2.5
gidnumber:
description:
- Posix Group ID
version_added: 2.5
extends_documentation_fragment: ipa.documentation extends_documentation_fragment: ipa.documentation
version_added: "2.3" version_added: "2.3"
requirements: requirements:
@ -76,6 +84,8 @@ EXAMPLES = '''
sshpubkey: sshpubkey:
- ssh-rsa .... - ssh-rsa ....
- ssh-dsa .... - ssh-dsa ....
uidnumber: 1001
gidnumber: 100
ipa_host: ipa.example.com ipa_host: ipa.example.com
ipa_user: admin ipa_user: admin
ipa_pass: topsecret ipa_pass: topsecret
@ -129,7 +139,7 @@ class UserIPAClient(IPAClient):
def get_user_dict(displayname=None, givenname=None, loginshell=None, mail=None, nsaccountlock=False, sn=None, def get_user_dict(displayname=None, givenname=None, loginshell=None, mail=None, nsaccountlock=False, sn=None,
sshpubkey=None, telephonenumber=None, title=None, userpassword=None): sshpubkey=None, telephonenumber=None, title=None, userpassword=None, gidnumber=None, uidnumber=None):
user = {} user = {}
if displayname is not None: if displayname is not None:
user['displayname'] = displayname user['displayname'] = displayname
@ -150,6 +160,10 @@ def get_user_dict(displayname=None, givenname=None, loginshell=None, mail=None,
user['title'] = title user['title'] = title
if userpassword is not None: if userpassword is not None:
user['userpassword'] = userpassword user['userpassword'] = userpassword
if gidnumber is not None:
user['gidnumber'] = gidnumber
if uidnumber is not None:
user['uidnumber'] = uidnumber
return user return user
@ -217,7 +231,8 @@ def ensure(module, client):
mail=module.params['mail'], sn=module.params['sn'], mail=module.params['mail'], sn=module.params['sn'],
sshpubkey=module.params['sshpubkey'], nsaccountlock=nsaccountlock, sshpubkey=module.params['sshpubkey'], nsaccountlock=nsaccountlock,
telephonenumber=module.params['telephonenumber'], title=module.params['title'], telephonenumber=module.params['telephonenumber'], title=module.params['title'],
userpassword=module.params['password']) userpassword=module.params['password'],
gidnumber=module.params.get('gidnumber'), uidnumber=module.params.get('uidnumber'))
ipa_user = client.user_find(name=name) ipa_user = client.user_find(name=name)
@ -250,6 +265,8 @@ def main():
mail=dict(type='list'), mail=dict(type='list'),
sn=dict(type='str'), sn=dict(type='str'),
uid=dict(type='str', required=True, aliases=['name']), uid=dict(type='str', required=True, aliases=['name']),
gidnumber=dict(type='str'),
uidnumber=dict(type='str'),
password=dict(type='str', no_log=True), password=dict(type='str', no_log=True),
sshpubkey=dict(type='list'), sshpubkey=dict(type='list'),
state=dict(type='str', default='present', state=dict(type='str', default='present',