mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-31 11:54:47 +00:00
Merge pull request #173 from t-woerner/ipauser_allow_userauthtype_reset
ipauser: Allow reset of userauthtype, do not depend on first,last for…
This commit is contained in:
@@ -408,7 +408,7 @@ Variable | Description | Required
|
|||||||
`manager` | List of manager user names. | no
|
`manager` | List of manager user names. | no
|
||||||
`carlicense` | List of car licenses. | no
|
`carlicense` | List of car licenses. | no
|
||||||
`sshpubkey` \| `ipasshpubkey` | List of SSH public keys. | no
|
`sshpubkey` \| `ipasshpubkey` | List of SSH public keys. | no
|
||||||
`userauthtype` | List of supported user authentication types. Choices: `password`, `radius` and `otp` | no
|
`userauthtype` | List of supported user authentication types. Choices: `password`, `radius`, `otp` and ``. Use empty string to reset userauthtype to the initial value. | no
|
||||||
`userclass` | User category. (semantics placed on this attribute are for local interpretation). | no
|
`userclass` | User category. (semantics placed on this attribute are for local interpretation). | no
|
||||||
`radius` | RADIUS proxy configuration | no
|
`radius` | RADIUS proxy configuration | no
|
||||||
`radiususer` | RADIUS proxy username | no
|
`radiususer` | RADIUS proxy username | no
|
||||||
|
|||||||
@@ -153,9 +153,12 @@ options:
|
|||||||
required: false
|
required: false
|
||||||
aliases: ["ipasshpubkey"]
|
aliases: ["ipasshpubkey"]
|
||||||
userauthtype:
|
userauthtype:
|
||||||
description: List of supported user authentication types
|
description:
|
||||||
choices=['password', 'radius', 'otp']
|
List of supported user authentication types
|
||||||
|
Use empty string to reset userauthtype to the initial value.
|
||||||
|
choices=['password', 'radius', 'otp', '']
|
||||||
required: false
|
required: false
|
||||||
|
aliases: ["ipauserauthtype"]
|
||||||
userclass:
|
userclass:
|
||||||
description:
|
description:
|
||||||
- User category
|
- User category
|
||||||
@@ -310,9 +313,12 @@ options:
|
|||||||
required: false
|
required: false
|
||||||
aliases: ["ipasshpubkey"]
|
aliases: ["ipasshpubkey"]
|
||||||
userauthtype:
|
userauthtype:
|
||||||
description: List of supported user authentication types
|
description:
|
||||||
choices=['password', 'radius', 'otp']
|
List of supported user authentication types
|
||||||
|
Use empty string to reset userauthtype to the initial value.
|
||||||
|
choices=['password', 'radius', 'otp', '']
|
||||||
required: false
|
required: false
|
||||||
|
aliases: ["ipauserauthtype"]
|
||||||
userclass:
|
userclass:
|
||||||
description:
|
description:
|
||||||
- User category
|
- User category
|
||||||
@@ -710,7 +716,7 @@ def main():
|
|||||||
default=None),
|
default=None),
|
||||||
userauthtype=dict(type='list', aliases=["ipauserauthtype"],
|
userauthtype=dict(type='list', aliases=["ipauserauthtype"],
|
||||||
default=None,
|
default=None,
|
||||||
choices=['password', 'radius', 'otp']),
|
choices=['password', 'radius', 'otp', '']),
|
||||||
userclass=dict(type="list", aliases=["class"],
|
userclass=dict(type="list", aliases=["class"],
|
||||||
default=None),
|
default=None),
|
||||||
radius=dict(type="str", aliases=["ipatokenradiusconfiglink"],
|
radius=dict(type="str", aliases=["ipatokenradiusconfiglink"],
|
||||||
@@ -854,13 +860,6 @@ def main():
|
|||||||
if names is not None and len(names) != 1:
|
if names is not None and len(names) != 1:
|
||||||
ansible_module.fail_json(
|
ansible_module.fail_json(
|
||||||
msg="Only one user can be added at a time using name.")
|
msg="Only one user can be added at a time using name.")
|
||||||
if action != "member":
|
|
||||||
# Only check first and last here if names is set
|
|
||||||
if names is not None:
|
|
||||||
if first is None:
|
|
||||||
ansible_module.fail_json(msg="First name is needed")
|
|
||||||
if last is None:
|
|
||||||
ansible_module.fail_json(msg="Last name is needed")
|
|
||||||
|
|
||||||
check_parameters(
|
check_parameters(
|
||||||
ansible_module, state, action,
|
ansible_module, state, action,
|
||||||
@@ -1035,6 +1034,13 @@ def main():
|
|||||||
if "noprivate" in args:
|
if "noprivate" in args:
|
||||||
del args["noprivate"]
|
del args["noprivate"]
|
||||||
|
|
||||||
|
# Ignore userauthtype if it is empty (for resetting)
|
||||||
|
# and not set in for the user
|
||||||
|
if "ipauserauthtype" not in res_find and \
|
||||||
|
"ipauserauthtype" in args and \
|
||||||
|
args["ipauserauthtype"] == ['']:
|
||||||
|
del args["ipauserauthtype"]
|
||||||
|
|
||||||
# For all settings is args, check if there are
|
# For all settings is args, check if there are
|
||||||
# different settings in the find result.
|
# different settings in the find result.
|
||||||
# If yes: modify
|
# If yes: modify
|
||||||
@@ -1043,6 +1049,14 @@ def main():
|
|||||||
commands.append([name, "user_mod", args])
|
commands.append([name, "user_mod", args])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
# Make sure we have a first and last name
|
||||||
|
if first is None:
|
||||||
|
ansible_module.fail_json(
|
||||||
|
msg="First name is needed")
|
||||||
|
if last is None:
|
||||||
|
ansible_module.fail_json(
|
||||||
|
msg="Last name is needed")
|
||||||
|
|
||||||
commands.append([name, "user_add", args])
|
commands.append([name, "user_add", args])
|
||||||
|
|
||||||
# Handle members: principal, manager, certificate and
|
# Handle members: principal, manager, certificate and
|
||||||
|
|||||||
Reference in New Issue
Block a user