Method: Strongbolt::Capability.to_table
- Defined in:
- lib/strongbolt/capability.rb
.to_table ⇒ Object
Group by model, ownership and tenant access and tells whether each action is set or not
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/strongbolt/capability.rb', line 57 def self.to_table table = [] all.ordered.each do |capability| if table.last.nil? || !(table.last[:model] == capability.model && table.last[:require_ownership] == capability.require_ownership && table.last[:require_tenant_access] == capability.require_tenant_access) table << { model: capability.model, require_ownership: capability.require_ownership, require_tenant_access: capability.require_tenant_access, find: false, create: false, update: false, destroy: false } end table.last[capability.action.to_sym] = true end table end |