Class: Permify::Clearance
- Inherits:
-
Object
- Object
- Permify::Clearance
- Defined in:
- lib/permify/clearance.rb
Overview
Clearance: Official authorization for something to proceed or take place
Instance Method Summary collapse
- #add(resource, action) ⇒ Object
- #find(resource, action) ⇒ Object
-
#initialize(repo) ⇒ Clearance
constructor
A new instance of Clearance.
Constructor Details
#initialize(repo) ⇒ Clearance
Returns a new instance of Clearance.
4 5 6 7 |
# File 'lib/permify/clearance.rb', line 4 def initialize(repo) @repo = repo @permissions = Permify::PermissionMap.new end |
Instance Method Details
#add(resource, action) ⇒ Object
9 10 11 12 |
# File 'lib/permify/clearance.rb', line 9 def add(resource, action) = (resource, action) .store(resource, action, ) end |
#find(resource, action) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/permify/clearance.rb', line 14 def find(resource, action) if !repo.(resource, action) .find(resource, action) || Permify::Permission::Null.new else combination = repo.(resource, action) combination.resolve(self) end end |