sanction 2.1.2 → 2.1.3

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: ef97b7042edafedf55e2bde7da8dede6a1aa628a
4
- data.tar.gz: 6f41a829e4b0a53bbd138d65ae29d6b138a2f51a
3
+ metadata.gz: a5fdf471eac63b74eeabe3808203eb4ae30b8bf4
4
+ data.tar.gz: bc0591b4a12d9a6b1e8aa5b66da842b8310cb42c
5
5
  SHA512:
6
- metadata.gz: 428b993f4be88352331de15a703e56440030b35e52277cecc7c4012d44d78699b190dd9957b9f0a24e60a0df2d5d5ff6b7dda44c7dcef0abca7ac89249691bd6
7
- data.tar.gz: 169be6b0f3db5d5f1d85e1547aca66de2fd7d8b26fc8959ed78cc395371ba27296db9cab3c8a6599c4284e5377cd2593befbd9ee9c5f4252c6dee262626b7fa6
6
+ metadata.gz: 399445b870a0c670fd4a14f9c818b2299f491e62bd76860570dbb5d741db504097e76173be218f4faffc9863de6044fe8faa95b3777eab4920f31a78c584c556
7
+ data.tar.gz: e0b915c4f81038dab6ff3e00028841022a9277928918ece7fec858884e7abcb4f015a59bd2a8344f2f1e325518609ade81ec780bfde69cf2fc73d79953932175
@@ -14,6 +14,7 @@ module Sanction
14
14
 
15
15
  def deny!
16
16
  ancestors.reject(&:persisted?).each(&:deny!)
17
+ @parent = root.find(@parent.type, @parent.id) unless @parent.persisted?
17
18
  @parent.resources << type
18
19
  @parent.resources.uniq!
19
20
  @parent.add_subject({
@@ -1,3 +1,3 @@
1
1
  module Sanction
2
- VERSION = "2.1.2"
2
+ VERSION = "2.1.3"
3
3
  end
@@ -10,6 +10,7 @@ module Sanction
10
10
 
11
11
  def allow!
12
12
  ancestors.reject(&:persisted?).each(&:allow!)
13
+ @parent = root.find(@parent.type, @parent.id) unless @parent.persisted?
13
14
  @parent.resources << type
14
15
  @parent.resources.uniq!
15
16
  @parent.add_subject({
@@ -41,6 +41,26 @@ describe 'application issues' do
41
41
  permission.path[:shelf][1234].permitted?.must_equal true
42
42
  end
43
43
  end
44
+
45
+ describe "allowing deeply nested objects" do
46
+ before do
47
+ permission.path[:shelf][1234][:pack][12].allow!
48
+ end
49
+
50
+ it 'should allow access to the pack' do
51
+ permission.path[:shelf][1234][:pack][12].permitted?.must_equal true
52
+ end
53
+ end
54
+
55
+ describe "denying deeply nested objects" do
56
+ before do
57
+ permission.path[:shelf][1234][:pack][12].deny!
58
+ end
59
+
60
+ it 'should allow access to the pack' do
61
+ permission.path[:shelf][1234][:pack][12].permitted?.must_equal false
62
+ end
63
+ end
44
64
  end
45
65
 
46
66
  describe 'admin user with one banned bookcase' do
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'sanction'
2
2
  require 'awesome_print'
3
+ require 'pry'
3
4
 
4
5
  require 'minitest/spec'
5
6
  require 'minitest/autorun'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanction
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Carlile
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-06 00:00:00.000000000 Z
12
+ date: 2015-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport