mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-18 16:31:26 -07:00
Add UpdateUserAccountTypes command to redfish_command (#9059)
* Add UpdateUserAccountTypes command to redfish_command https://github.com/ansible-collections/community.general/issues/9058 * Add changelog fragment * Update changelogs/fragments/9059-redfish_command-updateuseraccounttypes.yml Update changelog fragment Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
d0b4e91cac
commit
3506f73da1
3 changed files with 37 additions and 1 deletions
|
@ -1557,6 +1557,27 @@ class RedfishUtils(object):
|
|||
resp['msg'] = 'Modified account service'
|
||||
return resp
|
||||
|
||||
def update_user_accounttypes(self, user):
|
||||
account_types = user.get('account_accounttypes')
|
||||
oemaccount_types = user.get('account_oemaccounttypes')
|
||||
if account_types is None and oemaccount_types is None:
|
||||
return {'ret': False, 'msg':
|
||||
'Must provide account_accounttypes or account_oemaccounttypes for UpdateUserAccountTypes command'}
|
||||
|
||||
response = self._find_account_uri(username=user.get('account_username'),
|
||||
acct_id=user.get('account_id'))
|
||||
if not response['ret']:
|
||||
return response
|
||||
|
||||
uri = response['uri']
|
||||
payload = {}
|
||||
if user.get('account_accounttypes'):
|
||||
payload['AccountTypes'] = user.get('account_accounttypes')
|
||||
if user.get('account_oemaccounttypes'):
|
||||
payload['OEMAccountTypes'] = user.get('account_oemaccounttypes')
|
||||
|
||||
return self.patch_request(self.root_uri + uri, payload, check_pyld=True)
|
||||
|
||||
def check_password_change_required(self, return_data):
|
||||
"""
|
||||
Checks a response if a user needs to change their password
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue