i_am_i_can 3.0.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +236 -174
- data/lib/generators/i_am_i_can/setup_generator.rb +3 -7
- data/lib/generators/i_am_i_can/templates/migrations/i_am_i_can.erb +8 -8
- data/lib/generators/i_am_i_can/templates/models/permission.erb +4 -2
- data/lib/generators/i_am_i_can/templates/models/role.erb +3 -1
- data/lib/generators/i_am_i_can/templates/models/role_group.erb +3 -1
- data/lib/i_am_i_can/configs/config.rb +2 -3
- data/lib/i_am_i_can/configs/configs.rb +1 -7
- data/lib/i_am_i_can/helpers/dynamic.rb +102 -0
- data/lib/i_am_i_can/helpers/result_of.rb +71 -0
- data/lib/i_am_i_can/permission/assignment.rb +12 -60
- data/lib/i_am_i_can/permission/definition.rb +8 -28
- data/lib/i_am_i_can/permission.rb +18 -24
- data/lib/i_am_i_can/resource.rb +24 -19
- data/lib/i_am_i_can/role/assignment.rb +24 -45
- data/lib/i_am_i_can/role/definition.rb +17 -47
- data/lib/i_am_i_can/role.rb +14 -0
- data/lib/i_am_i_can/role_group/assignment.rb +6 -0
- data/lib/i_am_i_can/role_group/definition.rb +25 -0
- data/lib/i_am_i_can/subject/permission_querying.rb +28 -40
- data/lib/i_am_i_can/subject/role_querying.rb +8 -8
- data/lib/i_am_i_can/subject.rb +0 -10
- data/lib/i_am_i_can/support/association_class_methods.rb +43 -0
- data/lib/i_am_i_can/{configurable.rb → support/configurable.rb} +0 -7
- data/lib/i_am_i_can/support/reflection.rb +36 -0
- data/lib/i_am_i_can/version.rb +1 -1
- data/lib/i_am_i_can.rb +33 -16
- metadata +9 -9
- data/Gemfile.lock +0 -121
- data/lib/i_am_i_can/dynamic_generate.rb +0 -95
- data/lib/i_am_i_can/permission/helpers.rb +0 -75
- data/lib/i_am_i_can/permission/p_array.rb +0 -22
- data/lib/i_am_i_can/reflection.rb +0 -25
- data/lib/i_am_i_can/role/helpers.rb +0 -76
@@ -1,58 +1,28 @@
|
|
1
|
-
require 'i_am_i_can/role/helpers'
|
2
|
-
|
3
1
|
module IAmICan
|
4
2
|
module Role
|
5
3
|
module Definition
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
names.each do |name|
|
12
|
-
description = desc || name.to_s.humanize
|
13
|
-
if save
|
14
|
-
next failed_items << name unless _to_store_role(name, desc: description)
|
15
|
-
i_am_i_can.role_model.which(name: name).can *preds, obj: obj, auto_define_before: true, strict_mode: true if which_can.present?
|
16
|
-
else
|
17
|
-
next failed_items << name if defined_local_roles.key?(name)
|
18
|
-
defined_local_roles[name] ||= { desc: description, permissions: [ ] }
|
19
|
-
local_role_which(name: name, can: preds, obj: obj, auto_define_before: true, strict_mode: true) if which_can.present?
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
_role_definition_result(names, failed_items)
|
24
|
-
end
|
25
|
-
|
26
|
-
alias have_roles have_role
|
27
|
-
alias has_role have_role
|
28
|
-
alias has_roles have_role
|
29
|
-
|
30
|
-
def declare_role *names, **options
|
31
|
-
have_role *names, save: false, **options
|
32
|
-
end
|
33
|
-
|
34
|
-
alias declare_roles has_role
|
4
|
+
def have_role *roles, which_can: [ ], obj: nil
|
5
|
+
return unless roles.first.class.in?([ Symbol, String ])
|
6
|
+
roles.map!(&:to_sym) ; i = i_am_i_can
|
7
|
+
definition = _create_roles(roles.map { |role| { name: role } })
|
35
8
|
|
36
|
-
|
37
|
-
|
38
|
-
raise Error, "Given name #{by_name} has been used by a role" if i_am_i_can.role_model.exists?(name: by_name)
|
39
|
-
i_am_i_can.role_group_model.find_or_create_by!(name: by_name).members_add(members)
|
9
|
+
Role.modeling(roles, i).each { |r| r.can *which_can, obj: obj, auto_definition: true } if which_can.present?
|
10
|
+
ResultOf.roles definition, i, given: roles
|
40
11
|
end
|
41
12
|
|
42
|
-
|
43
|
-
|
44
|
-
alias groups_roles group_roles
|
45
|
-
|
46
|
-
def have_and_group_roles *members, by_name:
|
47
|
-
has_roles *members
|
48
|
-
group_roles *members, by_name: by_name
|
49
|
-
end
|
13
|
+
%i[ have_roles has_role has_roles ].each { |aname| alias_method aname, :have_role }
|
14
|
+
end
|
50
15
|
|
51
|
-
|
16
|
+
def self.modeling(objs, i_am_i_can)
|
17
|
+
return objs if objs.first.is_a?(i_am_i_can.role_model)
|
18
|
+
objs.map { |obj| i_am_i_can.role_model.where(name: obj).first_or_initialize }
|
19
|
+
end
|
52
20
|
|
53
|
-
|
54
|
-
|
55
|
-
|
21
|
+
def self.extract(param_roles, i_am_i_can)
|
22
|
+
roles = param_roles.group_by(&:class)
|
23
|
+
instances = roles[i_am_i_can.role_model] || []
|
24
|
+
names = roles.values_at(Symbol, String).flatten.compact.uniq.map(&:to_sym)
|
25
|
+
[ instances, names ]
|
56
26
|
end
|
57
27
|
end
|
58
28
|
end
|
data/lib/i_am_i_can/role.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'i_am_i_can/role/definition'
|
2
2
|
require 'i_am_i_can/role/assignment'
|
3
|
+
require 'i_am_i_can/role_group/definition'
|
4
|
+
require 'i_am_i_can/role_group/assignment'
|
3
5
|
|
4
6
|
module IAmICan
|
5
7
|
module Role
|
@@ -9,9 +11,21 @@ module IAmICan
|
|
9
11
|
def which(name:, **conditions)
|
10
12
|
find_by!(name: name, **conditions)
|
11
13
|
end
|
14
|
+
|
15
|
+
def names
|
16
|
+
self.pluck(:name).map(&:to_sym)
|
17
|
+
end
|
12
18
|
end
|
13
19
|
|
14
20
|
included do
|
21
|
+
# def attributes
|
22
|
+
# super.symbolize_keys
|
23
|
+
# end
|
24
|
+
|
25
|
+
# `can? :manage, User` / `can? :manage, obj: User`
|
26
|
+
def can? action, o = nil, obj: o
|
27
|
+
_permissions.matched?(action, obj)
|
28
|
+
end
|
15
29
|
end
|
16
30
|
end
|
17
31
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module IAmICan
|
2
|
+
module RoleGroup
|
3
|
+
module Definition
|
4
|
+
def group_roles *members, by_name:, which_can: [ ], obj: nil
|
5
|
+
group = (i = i_am_i_can).role_group_model.where(name: by_name).first_or_create
|
6
|
+
instances, names = Role.extract(members, i)
|
7
|
+
assignment = group._members_exec(:assignment, instances, name: names)
|
8
|
+
ResultOf.members assignment, i, given: [instances, names]
|
9
|
+
end
|
10
|
+
|
11
|
+
%i[ group_role groups_role groups_roles ].each { |aname| alias_method aname, :group_roles }
|
12
|
+
|
13
|
+
def remove_roles *members, from: nil
|
14
|
+
# TODO
|
15
|
+
end
|
16
|
+
|
17
|
+
def have_and_group_roles *members, by_name:
|
18
|
+
have_roles *members
|
19
|
+
group_roles *members, by_name: by_name
|
20
|
+
end
|
21
|
+
|
22
|
+
alias has_and_groups_roles have_and_group_roles
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,68 +1,56 @@
|
|
1
1
|
module IAmICan
|
2
2
|
module Subject
|
3
3
|
module PermissionQuerying
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
# TODO: without: :group
|
5
|
+
def can? action, o = nil, obj: o, without_group: false
|
6
|
+
temporarily_can?(action, obj) ||
|
7
|
+
stored_can?(action, obj) ||
|
8
|
+
group_can?(action, obj, without_group)
|
9
9
|
end
|
10
10
|
|
11
|
-
def cannot?
|
12
|
-
!can?
|
11
|
+
def cannot? action, o = nil, obj: o
|
12
|
+
!can? action, obj
|
13
13
|
end
|
14
14
|
|
15
|
-
def can!
|
16
|
-
raise InsufficientPermission if cannot?
|
15
|
+
def can! action, o = nil, obj: o
|
16
|
+
raise InsufficientPermission if cannot? action, obj
|
17
17
|
true
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
|
20
|
+
def can_one_of? actions, o = nil, obj: o
|
21
|
+
can? actions, obj
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
def can_each! preds, obj0 = nil, obj: nil
|
27
|
-
preds.each { |pred| can! pred, obj0, obj: obj } && true
|
28
|
-
end
|
29
|
-
|
30
|
-
alias can_every! can_each!
|
31
|
-
|
32
|
-
def can_one_of? preds, obj0 = nil, obj: nil
|
33
|
-
preds.each { |pred| return true if can? pred, obj0, obj: obj } && false
|
34
|
-
end
|
35
|
-
|
36
|
-
def can_one_of! preds, obj0 = nil, obj: nil
|
37
|
-
raise InsufficientPermission unless can_one_of? preds, obj0, obj: obj
|
24
|
+
def can_one_of! actions, o = nil, obj: o
|
25
|
+
raise InsufficientPermission unless can_one_of? actions, obj
|
38
26
|
true
|
39
27
|
end
|
40
28
|
|
41
|
-
def
|
42
|
-
|
29
|
+
def can_each? actions, o = nil, obj: o
|
30
|
+
# TODO: using `matched_all?`
|
31
|
+
actions.each { |action| return false if cannot? action, obj } && true
|
43
32
|
end
|
44
33
|
|
45
|
-
alias
|
34
|
+
alias can_every? can_each?
|
46
35
|
|
47
|
-
def
|
48
|
-
|
36
|
+
def can_each! actions, o = nil, obj: o
|
37
|
+
actions.each { |action| can! action, obj } && true
|
49
38
|
end
|
50
39
|
|
51
|
-
|
52
|
-
return false if without_group || i_am_i_can.without_group
|
53
|
-
i_am_i_can.permission_model.matched?(pred: pred, obj: obj, in: permissions_of_role_groups)
|
54
|
-
end
|
40
|
+
alias can_every! can_each!
|
55
41
|
|
56
|
-
def
|
57
|
-
|
42
|
+
def temporarily_can? action, obj
|
43
|
+
return false if temporary_roles.blank?
|
44
|
+
valid_temporary_roles._permissions.matched?(action, obj)
|
58
45
|
end
|
59
46
|
|
60
|
-
def
|
61
|
-
|
47
|
+
def stored_can? action, obj
|
48
|
+
_roles._permissions.matched?(action, obj)
|
62
49
|
end
|
63
50
|
|
64
|
-
def
|
65
|
-
|
51
|
+
def group_can? action, obj, without_group = false
|
52
|
+
return false if without_group || i_am_i_can.without_group
|
53
|
+
_roles._role_groups._permissions.matched?(action, obj)
|
66
54
|
end
|
67
55
|
end
|
68
56
|
end
|
@@ -4,8 +4,8 @@ module IAmICan
|
|
4
4
|
|
5
5
|
# === Role Querying ===
|
6
6
|
|
7
|
-
def is?
|
8
|
-
|
7
|
+
def is? role_name
|
8
|
+
roles.find_by(name: role_name).present?
|
9
9
|
end
|
10
10
|
|
11
11
|
alias is_role? is?
|
@@ -23,8 +23,8 @@ module IAmICan
|
|
23
23
|
alias is_role! is!
|
24
24
|
alias has_role! is!
|
25
25
|
|
26
|
-
def is_one_of? *
|
27
|
-
roles.
|
26
|
+
def is_one_of? *role_names
|
27
|
+
roles.where(name: role_names).present?
|
28
28
|
end
|
29
29
|
|
30
30
|
alias is_one_of_roles? is_one_of?
|
@@ -35,8 +35,8 @@ module IAmICan
|
|
35
35
|
|
36
36
|
alias is_one_of_roles! is_one_of!
|
37
37
|
|
38
|
-
def is_every? *
|
39
|
-
roles.
|
38
|
+
def is_every? *role_names
|
39
|
+
roles.where(name: role_names).count == role_names.count
|
40
40
|
end
|
41
41
|
|
42
42
|
alias is_every_role_in? is_every?
|
@@ -50,8 +50,8 @@ module IAmICan
|
|
50
50
|
# === Group Querying ===
|
51
51
|
|
52
52
|
def is_in_role_group? name
|
53
|
-
group_members =
|
54
|
-
(roles & group_members).present?
|
53
|
+
group_members = i_am_i_can.role_group_model.find_by!(name: name)._roles.names
|
54
|
+
(roles.names & group_members).present?
|
55
55
|
end
|
56
56
|
|
57
57
|
alias in_role_group? is_in_role_group?
|
data/lib/i_am_i_can/subject.rb
CHANGED
@@ -6,16 +6,6 @@ module IAmICan
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
8
|
class_methods do
|
9
|
-
# permission assignment locally for local role
|
10
|
-
# User.local_role_which(name: :admin, can: :fly)
|
11
|
-
# same effect to: UserRole.new(name: :admin).temporarily_can :fly
|
12
|
-
def local_role_which(name:, can:, obj: nil, **options)
|
13
|
-
i_am_i_can.role_model.new(name: name).temporarily_can *Array(can), obj: obj, **options
|
14
|
-
end
|
15
|
-
|
16
|
-
def members_of_role_group name
|
17
|
-
i_am_i_can.role_group_model.find_by!(name: name).member_names.sort
|
18
|
-
end
|
19
9
|
end
|
20
10
|
|
21
11
|
included do
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module IAmICan
|
2
|
+
module Association_ClassMethods
|
3
|
+
def has_many_temporary_roles(name: nil)
|
4
|
+
define_method :temporary_roles do
|
5
|
+
@temporary_roles ||= [ ]
|
6
|
+
end
|
7
|
+
#
|
8
|
+
alias_method name, :temporary_roles if name
|
9
|
+
|
10
|
+
define_method :valid_temporary_roles do
|
11
|
+
i_am_i_can.role_model.where(id: temporary_roles.map(&:id))
|
12
|
+
end
|
13
|
+
|
14
|
+
raise "Do not set the role association name to `roles` in #{self.class.name} model" if respond_to?(:roles)
|
15
|
+
define_method :roles do
|
16
|
+
ids = (temporary_roles.map(&:id) + _roles.ids).uniq
|
17
|
+
i_am_i_can.role_model.where(id: ids)
|
18
|
+
end
|
19
|
+
|
20
|
+
define_method :temporary_role_names do
|
21
|
+
temporary_roles.map(&:name).map(&:to_sym)
|
22
|
+
end
|
23
|
+
#
|
24
|
+
alias_method "#{name.to_s.singularize}_names", :temporary_role_names if name
|
25
|
+
|
26
|
+
define_method :_temporary_roles_add do |names|
|
27
|
+
names -= temporary_role_names
|
28
|
+
temporary_roles.concat(roles = i_am_i_can.role_model.where(name: names))
|
29
|
+
roles.names
|
30
|
+
end
|
31
|
+
|
32
|
+
define_method :_temporary_roles_rmv do |names|
|
33
|
+
(names & temporary_role_names).each do |n|
|
34
|
+
temporary_roles.reject! { |i| i.name.to_sym == n }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
define_method :_temporary_roles_exec do |action = :assignment, names|
|
39
|
+
send('_temporary_roles_' + (action == :assignment ? 'add' : 'rmv'), names)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -8,13 +8,6 @@ module IAmICan
|
|
8
8
|
def i_am_i_can
|
9
9
|
Configs.get(self.name)
|
10
10
|
end
|
11
|
-
|
12
|
-
def _reflect_of(key)
|
13
|
-
_name = i_am_i_can.send("#{key}_class")
|
14
|
-
reflections.each do |name, reflection|
|
15
|
-
return name if reflection.class_name == _name
|
16
|
-
end; nil
|
17
|
-
end
|
18
11
|
end
|
19
12
|
|
20
13
|
included do
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module IAmICan
|
2
|
+
module Reflection
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
class_methods do
|
6
|
+
def _reflect_of(key)
|
7
|
+
_name = i_am_i_can.send("#{key}_class")
|
8
|
+
reflections.each do |name, reflection|
|
9
|
+
return name if reflection.class_name == _name
|
10
|
+
end; nil
|
11
|
+
end
|
12
|
+
|
13
|
+
%w[ subjects roles role_groups permissions ].each do |k|
|
14
|
+
# User.__roles => 'stored_roles'
|
15
|
+
define_method "__#{k}" do
|
16
|
+
instance_variable_get(:"@__#{k}") or
|
17
|
+
instance_variable_set(:"@__#{k}", _reflect_of(k.singularize))
|
18
|
+
end
|
19
|
+
|
20
|
+
# User.all._roles == User.all.stored_roles
|
21
|
+
define_method "_#{k}" do
|
22
|
+
send(send("__#{k}")) rescue (raise NoMethodError)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
included do
|
28
|
+
# user._roles => Association CollectionProxy, same as: `user.stored_roles`
|
29
|
+
%w[ subjects roles role_groups permissions ].each do |k|
|
30
|
+
define_method "_#{k}" do
|
31
|
+
send(self.class.send("__#{k}")) rescue (raise NoMethodError)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/i_am_i_can/version.rb
CHANGED
data/lib/i_am_i_can.rb
CHANGED
@@ -3,9 +3,11 @@ require 'active_support/core_ext/object/inclusion'
|
|
3
3
|
require 'active_support/core_ext/hash/deep_merge'
|
4
4
|
|
5
5
|
require 'i_am_i_can/version'
|
6
|
-
require 'i_am_i_can/
|
7
|
-
require 'i_am_i_can/
|
8
|
-
require 'i_am_i_can/
|
6
|
+
require 'i_am_i_can/support/association_class_methods'
|
7
|
+
require 'i_am_i_can/support/configurable'
|
8
|
+
require 'i_am_i_can/support/reflection'
|
9
|
+
require 'i_am_i_can/helpers/result_of'
|
10
|
+
require 'i_am_i_can/helpers/dynamic'
|
9
11
|
require 'i_am_i_can/role'
|
10
12
|
require 'i_am_i_can/permission'
|
11
13
|
require 'i_am_i_can/subject'
|
@@ -18,13 +20,15 @@ module IAmICan
|
|
18
20
|
|
19
21
|
extend Role::Definition
|
20
22
|
include Role::Assignment
|
23
|
+
extend RoleGroup::Definition
|
21
24
|
include Subject::RoleQuerying
|
22
25
|
include Subject::PermissionQuerying
|
23
26
|
|
24
27
|
include Reflection
|
25
|
-
instance_exec(%i[ role ], &
|
26
|
-
instance_exec(&
|
27
|
-
instance_exec(%
|
28
|
+
instance_exec(%i[ role ], &Dynamic.scopes)
|
29
|
+
instance_exec(&Dynamic.class_reflections)
|
30
|
+
instance_exec(%w[ role ], &Dynamic.assignment_helpers)
|
31
|
+
instance_exec(%w[ role ], &Dynamic.definition_helpers)
|
28
32
|
end
|
29
33
|
|
30
34
|
def acts_as_role
|
@@ -35,22 +39,31 @@ module IAmICan
|
|
35
39
|
include Permission::Assignment
|
36
40
|
|
37
41
|
include Reflection
|
38
|
-
instance_exec(%i[ subject role_group permission ], &
|
39
|
-
instance_exec(&
|
40
|
-
instance_exec(%
|
42
|
+
instance_exec(%i[ subject role_group permission ], &Dynamic.scopes)
|
43
|
+
instance_exec(&Dynamic.class_reflections)
|
44
|
+
instance_exec(%w[ permission ], &Dynamic.assignment_helpers)
|
45
|
+
instance_exec(%w[ permission ], &Dynamic.definition_helpers)
|
46
|
+
|
47
|
+
before_create { self.remarks ||= name.to_s.humanize }
|
48
|
+
validates :name, uniqueness: true
|
41
49
|
end
|
42
50
|
|
43
51
|
def acts_as_role_group
|
44
52
|
i_am_i_can.act = :role_group
|
45
53
|
include Role
|
54
|
+
# include RoleGroup
|
46
55
|
|
47
56
|
extend Permission::Definition
|
48
57
|
include Permission::Assignment
|
49
58
|
|
50
59
|
include Reflection
|
51
|
-
instance_exec(%i[ permission role ], &
|
52
|
-
instance_exec(&
|
53
|
-
instance_exec(%
|
60
|
+
instance_exec(%i[ permission role ], &Dynamic.scopes)
|
61
|
+
instance_exec(&Dynamic.class_reflections)
|
62
|
+
instance_exec(%w[ role permission ], &Dynamic.assignment_helpers)
|
63
|
+
instance_exec(%w[ permission ], &Dynamic.definition_helpers)
|
64
|
+
|
65
|
+
before_create { self.remarks ||= name.to_s.humanize }
|
66
|
+
validates :name, uniqueness: true
|
54
67
|
end
|
55
68
|
|
56
69
|
def acts_as_permission
|
@@ -58,19 +71,23 @@ module IAmICan
|
|
58
71
|
include Permission
|
59
72
|
|
60
73
|
include Reflection
|
61
|
-
instance_exec(%i[ role role_group ], &
|
62
|
-
instance_exec(&
|
74
|
+
instance_exec(%i[ role role_group ], &Dynamic.scopes)
|
75
|
+
instance_exec(&Dynamic.class_reflections)
|
76
|
+
|
77
|
+
before_create { self.remarks ||= name.to_s.humanize }
|
78
|
+
validates :action, uniqueness: { scope: %i[ obj_type obj_id ] }
|
63
79
|
end
|
64
80
|
|
65
81
|
def acts_as_allowed_resource
|
66
82
|
include Resource
|
67
83
|
end
|
68
84
|
|
69
|
-
class Error
|
70
|
-
class VerificationFailed
|
85
|
+
class Error < StandardError; end
|
86
|
+
class VerificationFailed < Error; end
|
71
87
|
class InsufficientPermission < Error; end
|
72
88
|
end
|
73
89
|
|
74
90
|
ActiveRecord::Base.include IAmICan::Configurable
|
91
|
+
ActiveRecord::Base.extend IAmICan::Association_ClassMethods
|
75
92
|
ActiveRecord::Base.extend IAmICan
|
76
93
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i_am_i_can
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zhandao
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -180,7 +180,6 @@ files:
|
|
180
180
|
- CHANGELOG.md
|
181
181
|
- CODE_OF_CONDUCT.md
|
182
182
|
- Gemfile
|
183
|
-
- Gemfile.lock
|
184
183
|
- LICENSE.txt
|
185
184
|
- README.md
|
186
185
|
- Rakefile
|
@@ -196,22 +195,23 @@ files:
|
|
196
195
|
- lib/i_am_i_can.rb
|
197
196
|
- lib/i_am_i_can/configs/config.rb
|
198
197
|
- lib/i_am_i_can/configs/configs.rb
|
199
|
-
- lib/i_am_i_can/
|
200
|
-
- lib/i_am_i_can/
|
198
|
+
- lib/i_am_i_can/helpers/dynamic.rb
|
199
|
+
- lib/i_am_i_can/helpers/result_of.rb
|
201
200
|
- lib/i_am_i_can/permission.rb
|
202
201
|
- lib/i_am_i_can/permission/assignment.rb
|
203
202
|
- lib/i_am_i_can/permission/definition.rb
|
204
|
-
- lib/i_am_i_can/permission/helpers.rb
|
205
|
-
- lib/i_am_i_can/permission/p_array.rb
|
206
|
-
- lib/i_am_i_can/reflection.rb
|
207
203
|
- lib/i_am_i_can/resource.rb
|
208
204
|
- lib/i_am_i_can/role.rb
|
209
205
|
- lib/i_am_i_can/role/assignment.rb
|
210
206
|
- lib/i_am_i_can/role/definition.rb
|
211
|
-
- lib/i_am_i_can/
|
207
|
+
- lib/i_am_i_can/role_group/assignment.rb
|
208
|
+
- lib/i_am_i_can/role_group/definition.rb
|
212
209
|
- lib/i_am_i_can/subject.rb
|
213
210
|
- lib/i_am_i_can/subject/permission_querying.rb
|
214
211
|
- lib/i_am_i_can/subject/role_querying.rb
|
212
|
+
- lib/i_am_i_can/support/association_class_methods.rb
|
213
|
+
- lib/i_am_i_can/support/configurable.rb
|
214
|
+
- lib/i_am_i_can/support/reflection.rb
|
215
215
|
- lib/i_am_i_can/version.rb
|
216
216
|
homepage: https://github.com/zhandao/i_am_i_can
|
217
217
|
licenses:
|
data/Gemfile.lock
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
i_am_i_can (3.0.1)
|
5
|
-
activerecord
|
6
|
-
activesupport
|
7
|
-
railties
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
actionpack (5.2.1)
|
13
|
-
actionview (= 5.2.1)
|
14
|
-
activesupport (= 5.2.1)
|
15
|
-
rack (~> 2.0)
|
16
|
-
rack-test (>= 0.6.3)
|
17
|
-
rails-dom-testing (~> 2.0)
|
18
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
19
|
-
actionview (5.2.1)
|
20
|
-
activesupport (= 5.2.1)
|
21
|
-
builder (~> 3.1)
|
22
|
-
erubi (~> 1.4)
|
23
|
-
rails-dom-testing (~> 2.0)
|
24
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
25
|
-
activemodel (5.2.1)
|
26
|
-
activesupport (= 5.2.1)
|
27
|
-
activerecord (5.2.1)
|
28
|
-
activemodel (= 5.2.1)
|
29
|
-
activesupport (= 5.2.1)
|
30
|
-
arel (>= 9.0)
|
31
|
-
activesupport (5.2.1)
|
32
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
33
|
-
i18n (>= 0.7, < 2)
|
34
|
-
minitest (~> 5.1)
|
35
|
-
tzinfo (~> 1.1)
|
36
|
-
arel (9.0.0)
|
37
|
-
builder (3.2.3)
|
38
|
-
coderay (1.1.2)
|
39
|
-
concurrent-ruby (1.0.5)
|
40
|
-
crass (1.0.4)
|
41
|
-
database_cleaner (1.7.0)
|
42
|
-
diff-lcs (1.3)
|
43
|
-
docile (1.3.0)
|
44
|
-
erubi (1.7.1)
|
45
|
-
i18n (1.1.0)
|
46
|
-
concurrent-ruby (~> 1.0)
|
47
|
-
json (2.1.0)
|
48
|
-
loofah (2.2.2)
|
49
|
-
crass (~> 1.0.2)
|
50
|
-
nokogiri (>= 1.5.9)
|
51
|
-
method_source (0.9.0)
|
52
|
-
mini_portile2 (2.3.0)
|
53
|
-
minitest (5.11.3)
|
54
|
-
nokogiri (1.8.4)
|
55
|
-
mini_portile2 (~> 2.3.0)
|
56
|
-
pg (1.0.0)
|
57
|
-
pry (0.11.3)
|
58
|
-
coderay (~> 1.1.0)
|
59
|
-
method_source (~> 0.9.0)
|
60
|
-
rack (2.0.5)
|
61
|
-
rack-test (1.1.0)
|
62
|
-
rack (>= 1.0, < 3)
|
63
|
-
rails-dom-testing (2.0.3)
|
64
|
-
activesupport (>= 4.2.0)
|
65
|
-
nokogiri (>= 1.6)
|
66
|
-
rails-html-sanitizer (1.0.4)
|
67
|
-
loofah (~> 2.2, >= 2.2.2)
|
68
|
-
railties (5.2.1)
|
69
|
-
actionpack (= 5.2.1)
|
70
|
-
activesupport (= 5.2.1)
|
71
|
-
method_source
|
72
|
-
rake (>= 0.8.7)
|
73
|
-
thor (>= 0.19.0, < 2.0)
|
74
|
-
rake (10.5.0)
|
75
|
-
rspec (3.7.0)
|
76
|
-
rspec-core (~> 3.7.0)
|
77
|
-
rspec-expectations (~> 3.7.0)
|
78
|
-
rspec-mocks (~> 3.7.0)
|
79
|
-
rspec-core (3.7.1)
|
80
|
-
rspec-support (~> 3.7.0)
|
81
|
-
rspec-expectations (3.7.0)
|
82
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
-
rspec-support (~> 3.7.0)
|
84
|
-
rspec-mocks (3.7.0)
|
85
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
-
rspec-support (~> 3.7.0)
|
87
|
-
rspec-rails (3.7.2)
|
88
|
-
actionpack (>= 3.0)
|
89
|
-
activesupport (>= 3.0)
|
90
|
-
railties (>= 3.0)
|
91
|
-
rspec-core (~> 3.7.0)
|
92
|
-
rspec-expectations (~> 3.7.0)
|
93
|
-
rspec-mocks (~> 3.7.0)
|
94
|
-
rspec-support (~> 3.7.0)
|
95
|
-
rspec-support (3.7.1)
|
96
|
-
simplecov (0.16.1)
|
97
|
-
docile (~> 1.1)
|
98
|
-
json (>= 1.8, < 3)
|
99
|
-
simplecov-html (~> 0.10.0)
|
100
|
-
simplecov-html (0.10.2)
|
101
|
-
thor (0.20.0)
|
102
|
-
thread_safe (0.3.6)
|
103
|
-
tzinfo (1.2.5)
|
104
|
-
thread_safe (~> 0.1)
|
105
|
-
|
106
|
-
PLATFORMS
|
107
|
-
ruby
|
108
|
-
|
109
|
-
DEPENDENCIES
|
110
|
-
bundler (~> 1.16)
|
111
|
-
database_cleaner
|
112
|
-
i_am_i_can!
|
113
|
-
pg
|
114
|
-
pry
|
115
|
-
rake (~> 10.0)
|
116
|
-
rspec (~> 3.0)
|
117
|
-
rspec-rails
|
118
|
-
simplecov
|
119
|
-
|
120
|
-
BUNDLED WITH
|
121
|
-
1.16.6
|