bali 1.0.0rc1 → 1.0.0rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/bali.gemspec +0 -1
- data/lib/bali.rb +6 -4
- data/lib/bali/rule_class.rb +1 -1
- data/lib/bali/version.rb +1 -1
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c00de772752e74795255bcb26a90b5c9dee8e829
|
4
|
+
data.tar.gz: d22ec8ebd7fb7be2f179dd3c9bec50a700f00990
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc1e0ccba9e178f59f0a792c52a91315c81e755c83508f9a528b2c4a20127b5f586441e2273cef1c97e2ea59ca4952ea60fac6101d2b1493dde772acc937d237
|
7
|
+
data.tar.gz: da2384e2836663c6a7e99d7531fc040ea605c5659e5d8fe6f63bbd968bb0679d4ac45f8319aef214efab099c3cd4709ff3ffc19210176c7d34e6496a3313a3de
|
data/README.md
CHANGED
@@ -45,6 +45,7 @@ Rule in Bali is the law determining whether a user (called `subtarget`) can do o
|
|
45
45
|
can :delete, if: proc { |record| record.is_settled? }
|
46
46
|
end # finance_user description
|
47
47
|
describe :guest { cant_all }
|
48
|
+
describe nil { cant_all }
|
48
49
|
end # rules_for
|
49
50
|
end
|
50
51
|
```
|
@@ -104,4 +105,9 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
104
105
|
|
105
106
|
#### Version 1.0.0rc1
|
106
107
|
1. Fix bug where user can't check on class
|
107
|
-
2. Adding new clause: cant_all
|
108
|
+
2. Adding new clause: cant_all
|
109
|
+
|
110
|
+
#### Version 1.0.0rc2
|
111
|
+
1. [Fix bug when class's name, as a constant, is reloaded](http://stackoverflow.com/questions/2509350/rails-class-object-id-changes-after-i-make-a-request) (re-allocated to different address in the memory)
|
112
|
+
2. Allow describing rule for `nil`, useful if user is not authenticated thus role is probably `nil`
|
113
|
+
3. Remove pry from development dependency
|
data/bali.gemspec
CHANGED
data/lib/bali.rb
CHANGED
@@ -32,7 +32,8 @@ module Bali
|
|
32
32
|
|
33
33
|
rule_class_for(class_name)
|
34
34
|
else
|
35
|
-
|
35
|
+
raise Bali::DslError, "Target must be a class" unless target.is_a?(Class)
|
36
|
+
rule_class = RULE_CLASS_MAP[target.to_s]
|
36
37
|
raise Bali::DslError, "Rule class is not defined for: #{target}" if rule_class.nil?
|
37
38
|
rule_class
|
38
39
|
end
|
@@ -50,7 +51,7 @@ module Bali
|
|
50
51
|
target = rule_class.target_class
|
51
52
|
alias_target = rule_class.alias_name
|
52
53
|
|
53
|
-
raise "Target must be a class" unless target.is_a?(Class)
|
54
|
+
raise Bali::DslError, "Target must be a class" unless target.is_a?(Class)
|
54
55
|
|
55
56
|
# remove any previous association of rule
|
56
57
|
begin
|
@@ -68,9 +69,10 @@ module Bali
|
|
68
69
|
Bali::REVERSE_ALIASED_RULE_CLASS_MAP[target] = alias_target
|
69
70
|
end
|
70
71
|
|
71
|
-
Bali::RULE_CLASS_MAP[target] = rule_class
|
72
|
+
Bali::RULE_CLASS_MAP[target.to_s] = rule_class
|
73
|
+
rule_class
|
72
74
|
else
|
73
|
-
raise "Only allow instance of Bali::RuleClass"
|
75
|
+
raise Bali::DslError, "Only allow instance of Bali::RuleClass"
|
74
76
|
end
|
75
77
|
end # add_rule_class
|
76
78
|
end
|
data/lib/bali/rule_class.rb
CHANGED
@@ -18,7 +18,7 @@ class Bali::RuleClass
|
|
18
18
|
def add_rule_group(rule_group)
|
19
19
|
if rule_group.is_a?(Bali::RuleGroup)
|
20
20
|
target_user = rule_group.subtarget
|
21
|
-
self.rule_groups[target_user
|
21
|
+
self.rule_groups[Bali::RuleGroup.canon_name(target_user)] = rule_group
|
22
22
|
else
|
23
23
|
raise Bali::DslError, "Rule group must be an instance of Bali::RuleGroup"
|
24
24
|
end
|
data/lib/bali/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bali
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.0rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Pahlevi
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.3'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: pry
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.10'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0.10'
|
69
55
|
description: "Bali (Bulwark Authorization Library) is a universal authorization library,
|
70
56
|
in the sense that \n it does not assume you to use specific
|
71
57
|
Ruby library/gem/framework."
|