Module: IAmICan

Defined in:
lib/i_am_i_can.rb,
lib/i_am_i_can/role.rb,
lib/i_am_i_can/subject.rb,
lib/i_am_i_can/version.rb,
lib/i_am_i_can/resource.rb,
lib/i_am_i_can/permission.rb,
lib/i_am_i_can/reflection.rb,
lib/i_am_i_can/configurable.rb,
lib/i_am_i_can/role/helpers.rb,
lib/i_am_i_can/configs/config.rb,
lib/i_am_i_can/configs/configs.rb,
lib/i_am_i_can/role/assignment.rb,
lib/i_am_i_can/role/definition.rb,
lib/i_am_i_can/dynamic_generate.rb,
lib/i_am_i_can/permission/helpers.rb,
lib/i_am_i_can/permission/p_array.rb,
lib/i_am_i_can/permission/assignment.rb,
lib/i_am_i_can/permission/definition.rb,
lib/i_am_i_can/subject/role_querying.rb,
lib/generators/i_am_i_can/setup_generator.rb,
lib/i_am_i_can/subject/permission_querying.rb

Defined Under Namespace

Modules: Configs, Configurable, DynamicGenerate, Generators, Permission, Reflection, Resource, Role, Subject Classes: Error, InsufficientPermission, ThatAllow, VerificationFailed

Constant Summary collapse

VERSION =
'3.0.0'

Instance Method Summary collapse

Instance Method Details

#act_as_allowed_resourceObject



65
66
67
# File 'lib/i_am_i_can.rb', line 65

def act_as_allowed_resource
  include Resource
end

#act_as_permissionObject



56
57
58
59
60
61
62
63
# File 'lib/i_am_i_can.rb', line 56

def act_as_permission
  i_am_i_can.act = :permission
  include Permission

  include Reflection
  instance_exec(i[ role role_group ], &DynamicGenerate.scopes)
  instance_exec(&DynamicGenerate.class_reflections)
end

#act_as_roleObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/i_am_i_can.rb', line 30

def act_as_role
  i_am_i_can.act = :role
  include Role

  extend  Permission::Definition
  include Permission::Assignment

  include Reflection
  instance_exec(i[ subject role_group permission ], &DynamicGenerate.scopes)
  instance_exec(&DynamicGenerate.class_reflections)
  instance_exec(i[ permission ], &DynamicGenerate.assignment_helpers)
end

#act_as_role_groupObject



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/i_am_i_can.rb', line 43

def act_as_role_group
  i_am_i_can.act = :role_group
  include Role

  extend  Permission::Definition
  include Permission::Assignment

  include Reflection
  instance_exec(i[ permission role ], &DynamicGenerate.scopes)
  instance_exec(&DynamicGenerate.class_reflections)
  instance_exec(i[ role permission ], &DynamicGenerate.assignment_helpers)
end

#act_as_subjectObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/i_am_i_can.rb', line 15

def act_as_subject
  i_am_i_can.act = :subject
  include Subject

  extend  Role::Definition
  include Role::Assignment
  include Subject::RoleQuerying
  include Subject::PermissionQuerying

  include Reflection
  instance_exec(i[ role ], &DynamicGenerate.scopes)
  instance_exec(&DynamicGenerate.class_reflections)
  instance_exec(i[ role ], &DynamicGenerate.assignment_helpers)
end