Class: PEClient::Resource::RBACV1::Permissions
- Defined in:
- lib/pe_client/resources/rbac.v1/permissions.rb
Overview
You add permissions to roles to control what users can access and do in PE. Use the permissions endpoints to get information about objects you can create permissions for, what types of permissions you can create, and whether specific users can perform certain actions.
Constant Summary collapse
- BASE_PATH =
The base path for RBAC API v1 Permissions endpoints.
"#{RBACV1::BASE_PATH}/permitted".freeze
Instance Method Summary collapse
-
#instances(object_type:, action:) ⇒ Array<String>
For a specific object_type and action, get a list of instance IDs that the current authenticated user is permitted to take the specified action on.
-
#permitted(token:, permissions:) ⇒ Array<Boolean>
Query whether a user or user group can perform specified actions.
-
#types ⇒ Array<Hash>
Lists each object_type that you can regulate with RBAC permissions, the available actions for each type, and whether each action allows instance specification.
-
#user_instances(object_type:, action:, uuid:) ⇒ Array<String>
For a specific object_type and action, get a list of instance IDs that the specific user (identified by UUID) is permitted to take the specified action on.
Methods inherited from Base
Constructor Details
This class inherits a constructor from PEClient::Resource::Base
Instance Method Details
#instances(object_type:, action:) ⇒ Array<String>
For a specific object_type and action, get a list of instance IDs that the current authenticated user is permitted to take the specified action on.
59 60 61 |
# File 'lib/pe_client/resources/rbac.v1/permissions.rb', line 59 def instances(object_type:, action:) @client.get "#{BASE_PATH}/#{object_type}/#{action}" end |
#permitted(token:, permissions:) ⇒ Array<Boolean>
Query whether a user or user group can perform specified actions. Use this to check if a user or group already has a certain permission.
49 50 51 |
# File 'lib/pe_client/resources/rbac.v1/permissions.rb', line 49 def permitted(token:, permissions:) @client.post BASE_PATH, body: {token:, permissions:} end |
#types ⇒ Array<Hash>
Lists each object_type that you can regulate with RBAC permissions, the available actions for each type, and whether each action allows instance specification.
33 34 35 |
# File 'lib/pe_client/resources/rbac.v1/permissions.rb', line 33 def types @client.get "/types" end |
#user_instances(object_type:, action:, uuid:) ⇒ Array<String>
For a specific object_type and action, get a list of instance IDs that the specific user (identified by UUID) is permitted to take the specified action on.
70 71 72 |
# File 'lib/pe_client/resources/rbac.v1/permissions.rb', line 70 def user_instances(object_type:, action:, uuid:) @client.get "#{BASE_PATH}/#{object_type}/#{action}/#{uuid}" end |