Module: ILO_SDK::ManagerAccountHelper
- Included in:
- Client
- Defined in:
- lib/ilo-sdk/helpers/manager_account_helper.rb
Overview
Contains helper methods for Manager Account actions
Instance Method Summary collapse
-
#get_account_privileges(username) ⇒ Hash
Get the Privileges for a user.
-
#set_account_privileges(username, privileges) ⇒ Object
Set the privileges for a user.
Instance Method Details
#get_account_privileges(username) ⇒ Hash
Get the Privileges for a user
19 20 21 22 23 24 25 26 27 |
# File 'lib/ilo-sdk/helpers/manager_account_helper.rb', line 19 def get_account_privileges(username) response = rest_get('/redfish/v1/AccountService/Accounts/') accounts = response_handler(response)['Items'] accounts.each do |account| if account['Oem']['Hp']['LoginName'] == username return account['Oem']['Hp']['Privileges'] end end end |
#set_account_privileges(username, privileges) ⇒ Object
Set the privileges for a user
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/ilo-sdk/helpers/manager_account_helper.rb', line 40 def set_account_privileges(username, privileges) response = rest_get('/redfish/v1/AccountService/Accounts/') accounts = response_handler(response)['Items'] id = '0' accounts.each do |account| if account['Oem']['Hp']['LoginName'] == username id = account['Id'] break end end new_action = { 'Oem' => { 'Hp' => { 'Privileges' => privileges } } } response = rest_patch("/redfish/v1/AccountService/Accounts/#{id}/", body: new_action) response_handler(response) true end |