Method: Strongbolt::Capability.from_hash
- Defined in:
- lib/strongbolt/capability.rb
.from_hash(hash) ⇒ Object
Create a set capabilities from a hash which has:
model: "ModelName",
require_ownership: true,
require_tenant_access: false,
actions: [:find, :update]
Actions can be either one operation, an array of operations, or :all meaning all operations
118 119 120 121 122 123 124 125 126 |
# File 'lib/strongbolt/capability.rb', line 118 def self.from_hash(hash) hash.symbolize_keys! actions_from_list(hash[:actions]).map do |action| new model: hash[:model], require_ownership: hash[:require_ownership], require_tenant_access: hash[:require_tenant_access], action: action end end |