univention udm_user: add parameter to control password update (#20699)

* univention udm_user: added support to set the password always

* module udm_user: added version 2.3 to update_password
pull/20932/head
Tobias Rüetschi 8 years ago committed by Nathaniel Case
parent 4269b12c9d
commit 4f117df6ec

@ -304,6 +304,13 @@ options:
description: description:
- "Define the whole position of users object inside the LDAP tree, - "Define the whole position of users object inside the LDAP tree,
e.g. C(cn=employee,cn=users,ou=school,dc=example,dc=com)." e.g. C(cn=employee,cn=users,ou=school,dc=example,dc=com)."
update_password:
required: false
default: always
description:
- "C(always) will update passwords if they differ.
C(on_create) will only set the password for newly created users."
version_added: "2.3"
ou: ou:
required: false required: false
default: '' default: ''
@ -466,6 +473,9 @@ def main():
type='str'), type='str'),
position = dict(default='', position = dict(default='',
type='str'), type='str'),
update_password = dict(default='always',
choices=['always', 'on_create'],
type='str'),
ou = dict(default='', ou = dict(default='',
type='str'), type='str'),
subpath = dict(default='cn=users', subpath = dict(default='cn=users',
@ -530,7 +540,7 @@ def main():
password = module.params['password'] password = module.params['password']
if obj['password'] is None: if obj['password'] is None:
obj['password'] = password obj['password'] = password
else: if module.params['update_password'] == 'always':
old_password = obj['password'].split('}', 2)[1] old_password = obj['password'].split('}', 2)[1]
if crypt.crypt(password, old_password) != old_password: if crypt.crypt(password, old_password) != old_password:
obj['overridePWHistory'] = module.params['overridePWHistory'] obj['overridePWHistory'] = module.params['overridePWHistory']

Loading…
Cancel
Save