Module: Lockdown

Extended by:
Helper
Defined in:
lib/lockdown.rb,
lib/lockdown/rules.rb,
lib/lockdown/helper.rb,
lib/lockdown/system.rb,
lib/lockdown/context.rb,
lib/lockdown/session.rb,
lib/lockdown/database.rb,
lib/lockdown/permission.rb,
lib/lockdown/frameworks/rails.rb,
lib/lockdown/orms/active_record.rb,
lib/lockdown/frameworks/rails/view.rb,
lib/lockdown/frameworks/rails/controller.rb

Defined Under Namespace

Modules: Frameworks, Helper, Orms, Rules, Session Classes: Context, Controller, ControllerContext, Database, InvalidRuleAssignment, InvalidRuleContext, Model, ModelContext, ModelWhereContext, Permission, PermissionScopeCollision, RootContext, System

Constant Summary collapse

VERSION =
'0.9.9'

Class Method Summary collapse

Methods included from Helper

administrator_group_string, administrator_group_symbol, camelize, class_name_from_file, convert_reference_name, get_string, get_symbol, qualified_const_defined?, qualified_const_get, random_string

Class Method Details

.major_versionObject



13
14
15
# File 'lib/lockdown.rb', line 13

def self.major_version
  version.split('.')[0].to_i
end

.minor_versionObject



17
18
19
# File 'lib/lockdown.rb', line 17

def self.minor_version
  version.split('.')[1].to_i
end

.mixinObject

Mixin Lockdown code to the appropriate framework and ORM



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/lockdown.rb', line 26

def self.mixin
  if mixin_resource?("frameworks")
    unless mixin_resource?("orms")
      raise NotImplementedError, "ORM unknown to Lockdown!"
    end

    begin
      puts "=> Requiring Lockdown rules engine: #{Lockdown.init_file} \n"
      require Lockdown.init_file
    rescue
      puts "=> Note:: Lockdown couldn't find init file: #{Lockdown.init_file}\n"
    end
  else
    puts "=> Note:: Lockdown cannot determine framework and therefore is not active.\n"
  end
end

.patch_versionObject



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

def self.patch_version
  version.split('.')[2].to_i
end

.versionObject

Returns the version string for the library.



9
10
11
# File 'lib/lockdown.rb', line 9

def self.version
  VERSION
end