rbac_core 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df306609cd77a207bd0ada04e4397d7b0e8e8290
4
- data.tar.gz: 936a2785debff5d5df1ef9a009a6ddf502ed9a2b
3
+ metadata.gz: 9eca9ebba658b6691ae7d818af2900d38ec1e655
4
+ data.tar.gz: f27ce0ee4189be36096323948f3c2b4a26da9036
5
5
  SHA512:
6
- metadata.gz: 75ba216e088bf694a17cf1956ae7a24d8d085571aff9f7cb99776d13f0a2768112c9e99cb666161e0c2f5c3b298caf91e01f7560db26721871545608b989ea18
7
- data.tar.gz: e1f48bbc5f4a81cefc1eed90d57a9ca6433e0999278970c8d2437c74aba120eae95f911e33f859608a76f116dea02a3c543df3a2f28482c370f82c37b626942f
6
+ metadata.gz: 1f66e91da0174f6251174348d58178cf2884cf336a540e3c48002209d6bbb372c54a1a252581d389d270a9f2ffd2d0f74c86033589c67d6838e5593e98f909cc
7
+ data.tar.gz: 2cd49e7d7b9b54fbea1f314f0861e2d2529077dbc568d0862a87330bdd9dcf688319d0fbee144d1a1bc5ec3cb20148450d1d1a198f8b6d168db6add763cca63a
@@ -16,6 +16,14 @@ module RbacCore
16
16
  @permission_set_class ||= PermissionSet.derive "Global"
17
17
  end
18
18
 
19
+ def permission_set_class=(klass)
20
+ unless klass && klass < PermissionSet
21
+ raise ArgumentError, "#{klass} should be sub-class of #{PermissionSet}."
22
+ end
23
+
24
+ @permission_set_class = klass
25
+ end
26
+
19
27
  def permission_class
20
28
  @permission_class ||= Permission
21
29
  end
@@ -20,6 +20,18 @@ module RbacCore
20
20
  :rbac_core
21
21
  end
22
22
 
23
+ def permission_class
24
+ @permission_class || RbacCore.permission_class
25
+ end
26
+
27
+ def permission_class=(klass)
28
+ unless klass && klass < Permission
29
+ raise ArgumentError, "#{klass} should be sub-class of #{Permission}."
30
+ end
31
+
32
+ @permission_class = klass
33
+ end
34
+
23
35
  def draw(**constraints, &block)
24
36
  unless block_given?
25
37
  raise ArgumentError, "must provide a block"
@@ -38,7 +50,7 @@ module RbacCore
38
50
  raise ArgumentError, "`name` can't be blank" if name.blank?
39
51
 
40
52
  attribute name, :boolean, default: default
41
- registered_permissions[name] = RbacCore.permission_class.new name, options, &block
53
+ registered_permissions[name] = permission_class.new name, options, &block
42
54
  end
43
55
  end
44
56
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RbacCore
4
- VERSION = "0.0.10"
4
+ VERSION = "0.0.11"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbac_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - jasl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-05 00:00:00.000000000 Z
11
+ date: 2018-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.6.13
89
+ rubygems_version: 2.6.12
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: A Rails engine providing essential industry of Role-based access control