Class: Fiona7::PermissionVolatileCache
- Inherits:
-
Object
- Object
- Fiona7::PermissionVolatileCache
- Defined in:
- lib/fiona7/permission_volatile_cache.rb
Constant Summary collapse
- PERMISSION_KEY =
"F7PERMISSION_CACHE"
Instance Method Summary collapse
-
#initialize(request) ⇒ PermissionVolatileCache
constructor
A new instance of PermissionVolatileCache.
- #permitted?(user_name, obj_id, action) ⇒ Boolean
Constructor Details
#initialize(request) ⇒ PermissionVolatileCache
Returns a new instance of PermissionVolatileCache.
5 6 7 8 |
# File 'lib/fiona7/permission_volatile_cache.rb', line 5 def initialize(request) request[PERMISSION_KEY] ||= {} self.storage = request[PERMISSION_KEY] end |
Instance Method Details
#permitted?(user_name, obj_id, action) ⇒ Boolean
10 11 12 |
# File 'lib/fiona7/permission_volatile_cache.rb', line 10 def permitted?(user_name, obj_id, action) self.storage["#{user_name}:#{obj_id}:#{action}"] ||= lookup(user_name, obj_id, action) end |