Class: Lockdown::System

Inherits:
Object
  • Object
show all
Extended by:
Rules
Defined in:
lib/lockdown/system.rb

Instance Attribute Summary

Attributes included from Rules

#controller_classes, #options, #permission_objects, #permissions, #protected_access, #public_access, #user_groups

Class Method Summary collapse

Methods included from Rules

access_rights_for_permission, access_rights_for_user, administrator?, get_permissions, get_user_groups, make_user_administrator, permission_assigned_automatically?, permission_exists?, permissions_assignable_for_user, permissions_for_user_group, process_rules, protected_access?, public_access?, set_defaults, set_permission, set_protected_access, set_public_access, set_user_group, standard_authorized_user_rights, user_group_exists?, user_groups_assignable_for_user, user_has_user_group?

Class Method Details

.call(object, system_option) ⇒ Object



24
25
26
27
28
29
# File 'lib/lockdown/system.rb', line 24

def self.call(object, system_option)
  method = fetch(system_option)
  if method.is_a?(Symbol) && object.respond_to?(method)
    object.send(method) 
  end
end

.configure(&block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/lockdown/system.rb', line 5

def self.configure(&block)
  set_defaults 

  # Defined by the framework
  load_controller_classes

  # Lockdown::Rules defines the methods that are used inside block
  instance_eval(&block)

  # Lockdown::Rules defines process_rules
  process_rules

  Lockdown::Database.sync_with_db unless skip_sync?
end

.fetch(key) ⇒ Object



20
21
22
# File 'lib/lockdown/system.rb', line 20

def self.fetch(key)
  (@options||={})[key]
end