Module: ActionGuard

Defined in:
lib/action-guard/version.rb,
lib/action-guard.rb,
lib/action-guard/base.rb,
lib/action-guard/role.rb,
lib/action-guard/rules.rb,
lib/action-guard/syntax.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Version Classes: AllowRule, DisallowRule, Error, ExactRoleRule, Guard, LevelRule, Role, Syntax

Class Method Summary collapse

Class Method Details

.authorized?(person, path) ⇒ Boolean

Returns:

  • (Boolean)

19
20
21
# File 'lib/action-guard.rb', line 19

def self.authorized?(person, path)
  @action_guard.authorized?(person, path) 
end

.flushObject


9
10
11
# File 'lib/action-guard.rb', line 9

def self.flush
  @action_guard = ActionGuard::Guard.new
end

.load_from_file(file_path) ⇒ Object


13
14
15
16
17
# File 'lib/action-guard.rb', line 13

def self.load_from_file(file_path)
  raise "authorization file #{file_path} not found" unless File.file?(file_path)
  @action_guard = ActionGuard::Guard.new
  @action_guard.load_from_string(File.read(file_path), file_path)
end

.valid_rolesObject


23
24
25
# File 'lib/action-guard.rb', line 23

def self.valid_roles
  @action_guard.valid_roles
end