Class: Checkpoint::DB::Grant

Inherits:
Object
  • Object
show all
Defined in:
lib/checkpoint/db/grant.rb

Overview

Sequel model for grants

Class Method Summary collapse

Class Method Details

.default_zoneObject

The default/system zone



19
20
21
# File 'lib/checkpoint/db/grant.rb', line 19

def self.default_zone
  '(all)'
end

.from(agent, credential, resource, zone: default_zone) ⇒ Object

Instantiate a Grant from the constituent domain objects (agent, resource, credential).



9
10
11
12
13
14
15
16
# File 'lib/checkpoint/db/grant.rb', line 9

def self.from(agent, credential, resource, zone: default_zone)
  new(
    agent_type: agent.type,           agent_id: agent.id,           agent_token: agent.token,
    credential_type: credential.type, credential_id: credential.id, credential_token: credential.token,
    resource_type: resource.type,     resource_id: resource.id,     resource_token: resource.token,
    zone_id: zone
  )
end