1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

minor fixes, also handle 'values' passed to dscl

This commit is contained in:
Brian Coca 2018-04-13 17:03:08 -04:00 committed by Brian Coca
parent 790a117b21
commit 1d58585945

View file

@ -44,6 +44,7 @@ options:
description:
- Darwin/OS X only, optionally hide the user from the login window and system preferences.
- The default will be 'True' if the I(system) option is used.
version_added: "2.6"
non_unique:
description:
- Optionally when used with the -u option, this option allows to
@ -271,7 +272,7 @@ class User(object):
self.state = module.params['state']
self.name = module.params['name']
self.uid = module.params['uid']
self.hidden = module.params['hidden']
self.hidden = module.params['hidden']
self.non_unique = module.params['non_unique']
self.seuser = module.params['seuser']
self.group = module.params['group']
@ -1521,6 +1522,23 @@ class DarwinUser(User):
('hidden', 'IsHidden'),
]
def __init__(self, module):
super(DarwinUser, self).__init__(module)
# make the user hidden if option is set or deffer to system option
if self.hidden is None:
if self.system:
self.hidden = 1
elif self.hidden:
self.hidden = 1
else:
self.hidden = 0
# add hidden to processing if set
if self.hidden is not None:
self.fields.append(('hidden', 'IsHidden'))
def _get_dscl(self):
return [self.module.get_bin_path('dscl', True), self.dscl_directory]