Class: ForestLiana::PermissionsChecker

Inherits:
Object
  • Object
show all
Defined in:
app/services/forest_liana/permissions_checker.rb

Constant Summary collapse

@@permissions_per_rendering =
Hash.new
@@expiration_in_seconds =
(ENV['FOREST_PERMISSIONS_EXPIRATION_IN_SECONDS'] || 3600).to_i

Instance Method Summary collapse

Constructor Details

#initialize(resource, permission_name, rendering_id, smart_action_parameters = nil, collection_list_parameters = nil) ⇒ PermissionsChecker



6
7
8
9
10
11
12
# File 'app/services/forest_liana/permissions_checker.rb', line 6

def initialize(resource, permission_name, rendering_id, smart_action_parameters = nil, collection_list_parameters = nil)
  @collection_name = ForestLiana.name_for(resource)
  @permission_name = permission_name
  @rendering_id = rendering_id
  @smart_action_parameters = smart_action_parameters
  @collection_list_parameters = collection_list_parameters
end

Instance Method Details

#is_authorized?Boolean



14
15
16
# File 'app/services/forest_liana/permissions_checker.rb', line 14

def is_authorized?
  (is_permission_expired? || !is_allowed?) ? retrieve_permissions_and_check_allowed : true
end