Class: SharedCredential
- Inherits:
-
Domain::Model
- Object
- Domain::Model
- SharedCredential
- Defined in:
- lib/domain/shared_credential/model.rb
Overview
SharedCredential represents a credential that can be used across multiple sites in the system.
This class serves as a representation of shared credentials, which are primarily managed through the API, as there is no corresponding dimension in the database.
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#description ⇒ Object
Returns the value of attribute description.
-
#host_restriction ⇒ Object
Returns the value of attribute host_restriction.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#port_restriction ⇒ Object
Returns the value of attribute port_restriction.
-
#site_assignment ⇒ Object
Returns the value of attribute site_assignment.
-
#sites ⇒ Object
Returns the value of attribute sites.
Instance Method Summary collapse
- #assigned_to_all_sites? ⇒ Boolean
-
#cyberark?(country) ⇒ Boolean
returns true if the name starts with CyberArk and the name contains the country name.
- #domain ⇒ Object
- #permission_elevation ⇒ Object
- #permission_elevation_user_name ⇒ Object
- #service ⇒ Object
- #service_name ⇒ Object
- #to_csv ⇒ Object
- #to_json(*_options) ⇒ Object
- #to_s ⇒ Object
- #user_name ⇒ Object
Methods inherited from Domain::Model
columns, from_csv, from_json, headers, #initialize, primary_key, table_name, #to_hash, view
Constructor Details
This class inherits a constructor from Domain::Model
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
11 12 13 |
# File 'lib/domain/shared_credential/model.rb', line 11 def account @account end |
#description ⇒ Object
Returns the value of attribute description.
11 12 13 |
# File 'lib/domain/shared_credential/model.rb', line 11 def description @description end |
#host_restriction ⇒ Object
Returns the value of attribute host_restriction.
11 12 13 |
# File 'lib/domain/shared_credential/model.rb', line 11 def host_restriction @host_restriction end |
#id ⇒ Object
Returns the value of attribute id.
11 12 13 |
# File 'lib/domain/shared_credential/model.rb', line 11 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/domain/shared_credential/model.rb', line 11 def name @name end |
#port_restriction ⇒ Object
Returns the value of attribute port_restriction.
11 12 13 |
# File 'lib/domain/shared_credential/model.rb', line 11 def port_restriction @port_restriction end |
#site_assignment ⇒ Object
Returns the value of attribute site_assignment.
11 12 13 |
# File 'lib/domain/shared_credential/model.rb', line 11 def site_assignment @site_assignment end |
#sites ⇒ Object
Returns the value of attribute sites.
11 12 13 |
# File 'lib/domain/shared_credential/model.rb', line 11 def sites @sites end |
Instance Method Details
#assigned_to_all_sites? ⇒ Boolean
73 74 75 |
# File 'lib/domain/shared_credential/model.rb', line 73 def assigned_to_all_sites? site_assignment == 'all-sites' end |
#cyberark?(country) ⇒ Boolean
returns true if the name starts with CyberArk and the name contains the country name
69 70 71 |
# File 'lib/domain/shared_credential/model.rb', line 69 def cyberark?(country) name.downcase.include?('cyberark') && name.downcase.include?(country.downcase) end |
#domain ⇒ Object
20 21 22 |
# File 'lib/domain/shared_credential/model.rb', line 20 def domain @account['domain'] end |
#permission_elevation ⇒ Object
36 37 38 |
# File 'lib/domain/shared_credential/model.rb', line 36 def @account['permissionElevation'] end |
#permission_elevation_user_name ⇒ Object
40 41 42 |
# File 'lib/domain/shared_credential/model.rb', line 40 def @account['permissionElevationUsername'] end |
#service ⇒ Object
24 25 26 |
# File 'lib/domain/shared_credential/model.rb', line 24 def service @account['service'] end |
#service_name ⇒ Object
28 29 30 |
# File 'lib/domain/shared_credential/model.rb', line 28 def service_name @account['serviceName'] end |
#to_csv ⇒ Object
61 62 63 64 |
# File 'lib/domain/shared_credential/model.rb', line 61 def to_csv site_ids = sites&.join('|') || '' [id, name, account, site_assignment, site_ids].join ',' end |
#to_json(*_options) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/domain/shared_credential/model.rb', line 44 def to_json(*) { account: @account, description: @description, hostRestriction: @host_restriction, id: @id, name: @name, portRestriction: @port_restriction, siteAssignment: @site_assignment, sites: @sites }.to_json end |
#to_s ⇒ Object
57 58 59 |
# File 'lib/domain/shared_credential/model.rb', line 57 def to_s "#{name} #{account}" end |
#user_name ⇒ Object
32 33 34 |
# File 'lib/domain/shared_credential/model.rb', line 32 def user_name @account['userName'] end |