rbac_core 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3052b5cce327658cc2c957432c456a5041a6394e
|
4
|
+
data.tar.gz: 1e7bd8c9b799b916c097018c244a7efc05b635b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2034552c254ba6cb7539d531004c7d42df0849f1229740c819fab4fc9b3b5f1a349abf4aa1db06d2629d9c6514d58a93b961d889a229ea167c8dab8445b6bdd
|
7
|
+
data.tar.gz: e2192ecc0b42239526d0c98b0c61fdf42781a80c2dc9a0bb18ce36e8f7cfe656ba9cdb1a9bd35eb9a299a70858c0619f4807e83446cfda2558dbc13a715d1280
|
data/lib/rbac_core.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "rbac_core/engine"
|
2
2
|
|
3
3
|
require "options_model"
|
4
|
-
require "rbac_core/
|
4
|
+
require "rbac_core/permission"
|
5
5
|
require "rbac_core/mapper"
|
6
6
|
require "rbac_core/permission_set"
|
7
7
|
|
@@ -13,16 +13,16 @@ module RbacCore
|
|
13
13
|
@permission_set_class ||= PermissionSet.derive "Global"
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
@
|
16
|
+
def permission_class
|
17
|
+
@permission_class ||= Permission
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
unless klass && klass <
|
22
|
-
raise ArgumentError, "#{klass} should be sub-class of #{
|
20
|
+
def permission_class=(klass)
|
21
|
+
unless klass && klass < Permission
|
22
|
+
raise ArgumentError, "#{klass} should be sub-class of #{Permission}."
|
23
23
|
end
|
24
24
|
|
25
|
-
@
|
25
|
+
@permission_class = klass
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module RbacCore
|
2
|
-
class
|
2
|
+
class Permission
|
3
3
|
attr_reader :action, :priority
|
4
4
|
|
5
5
|
def initialize(action, priority: 0, **options, &block)
|
@@ -16,7 +16,7 @@ module RbacCore
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def ==(other)
|
19
|
-
unless other.is_a?(RbacCore::
|
19
|
+
unless other.is_a?(RbacCore::Permission)
|
20
20
|
return false
|
21
21
|
end
|
22
22
|
|
@@ -36,7 +36,7 @@ module RbacCore
|
|
36
36
|
raise ArgumentError, "`name` can't be blank" if name.blank?
|
37
37
|
|
38
38
|
attribute name, :boolean, default: default
|
39
|
-
registered_permissions[name] = RbacCore.
|
39
|
+
registered_permissions[name] = RbacCore.permission_class.new name, options, &block
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
data/lib/rbac_core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbac_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jasl
|
@@ -55,7 +55,7 @@ files:
|
|
55
55
|
- lib/rbac_core/concerns/models/role.rb
|
56
56
|
- lib/rbac_core/engine.rb
|
57
57
|
- lib/rbac_core/mapper.rb
|
58
|
-
- lib/rbac_core/
|
58
|
+
- lib/rbac_core/permission.rb
|
59
59
|
- lib/rbac_core/permission_set.rb
|
60
60
|
- lib/rbac_core/version.rb
|
61
61
|
- lib/tasks/rbac_core_tasks.rake
|