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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a81d37c12d122debb6581425d2b059f60860736
4
- data.tar.gz: 2ae9be280d0738122c2e2825cbf8ec65d5374d6d
3
+ metadata.gz: c00de772752e74795255bcb26a90b5c9dee8e829
4
+ data.tar.gz: d22ec8ebd7fb7be2f179dd3c9bec50a700f00990
5
5
  SHA512:
6
- metadata.gz: 94f479a43d56ebdb12808e466e09e5aa34e5d9748b112a337b91058dcaca2348aa13ecf4a2250b79433894cb87ed7f160360114f15434e9b4da21eb10275d4b7
7
- data.tar.gz: 23c47258175bf243764327914e0cc296b5864b582e2421474d169c2d0ddba1a73d9fa9b3e6f4dea9352742b6fc41ba1515bdc5a82897be9d1750d6e55ae022f8
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
@@ -23,6 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "bundler", "~> 1.9"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency "rspec", "~> 3.3"
26
- spec.add_development_dependency "pry", "~> 0.10"
27
26
 
28
27
  end
@@ -32,7 +32,8 @@ module Bali
32
32
 
33
33
  rule_class_for(class_name)
34
34
  else
35
- rule_class = RULE_CLASS_MAP[target]
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
@@ -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.to_sym] = rule_group
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
@@ -1,3 +1,3 @@
1
1
  module Bali
2
- VERSION = "1.0.0rc1"
2
+ VERSION = "1.0.0rc2"
3
3
  end
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.0rc1
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."