Class: LogicalAuthz::AccessControl::Owner
- Defined in:
- lib/logical_authz/access_control.rb
Instance Attribute Summary
Attributes inherited from Policy
Instance Method Summary collapse
- #check(criteria) ⇒ Object
- #default_name ⇒ Object
-
#initialize(&map_owner) ⇒ Owner
constructor
A new instance of Owner.
Methods inherited from Policy
#evaluate, #laz_debug, names, register
Constructor Details
#initialize(&map_owner) ⇒ Owner
Returns a new instance of Owner.
306 307 308 309 |
# File 'lib/logical_authz/access_control.rb', line 306 def initialize(&map_owner) @mapper = map_owner super() end |
Instance Method Details
#check(criteria) ⇒ Object
315 316 317 318 319 320 321 322 |
# File 'lib/logical_authz/access_control.rb', line 315 def check(criteria) return false unless criteria.has_key?(:user) and criteria.has_key?(:id) unless @mapper.nil? @mapper.call(criteria[:user], criteria[:id].to_i) else criteria[:user].id == criteria[:id].to_i end end |
#default_name ⇒ Object
311 312 313 |
# File 'lib/logical_authz/access_control.rb', line 311 def default_name "Related" end |