permission_policy 0.1.2 → 0.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: 1e1762c7aaad4769ba3c48d5c6492791f8e5bb67
4
- data.tar.gz: 638cdbb47ae95440b50b26c11916e6a779a919e6
3
+ metadata.gz: a1e6ec5b93dd0bc7ca5497b8b6782fc7e6e418d2
4
+ data.tar.gz: f7030682a9d3730b6bd5aa66baa9103d14ae28d8
5
5
  SHA512:
6
- metadata.gz: 7880ff541ce50d13c811510f4a7761a0672692865f1458f3ffcb3fbf75b6e163d948ed61286f76082e9184d9fb2fd133546611bc13e9c7d598e33ecc1a7edc3a
7
- data.tar.gz: 46592fea7b72463cb0a64ddafc62f1f05c4aaca207d48e59aadd034c97e77a82ae0125b987b9480a8a0103ebd98c070efb2dfe1708b579153a58802214c9c990
6
+ metadata.gz: c3d55e847954f0cd5cd854c0280e326842070ef52269ec6d7838eadb7a198d6241669df60a21e1f0cbb5c5510cbaf106f26847b1d1cd3df2fb98ac110cd367e4
7
+ data.tar.gz: 2ac77c16affac60d940a325af8244d8f35109662db81411918b740cec0e78892c398f1acd97d9f82e8d942a03864d2532be96f834805c8b7fba91abe49342f81
@@ -1,4 +1,9 @@
1
1
 
2
+ # 0.1.3
3
+
4
+ * [BUGFIX] Always ask for the current value in the context and do not memoize
5
+
6
+
2
7
  # 0.1.2
3
8
 
4
9
  * [EXPERIMENTAL BUGFIX] possibility to read yml permission file
@@ -1,6 +1,6 @@
1
1
  module PermissionPolicy
2
2
  class Authorization
3
- attr_reader :preconditions, :verified
3
+ attr_reader :preconditions, :verified, :context
4
4
 
5
5
  def initialize(context)
6
6
  @preconditions = []
@@ -17,7 +17,7 @@ module PermissionPolicy
17
17
  def initialize(authorization, action = nil, options = {})
18
18
  authorization.preconditions.each do |attribute|
19
19
  self.class.send(:attr_accessor, attribute)
20
- instance_variable_set(:"@#{attribute}", authorization.public_send(attribute))
20
+ instance_variable_set(:"@#{attribute}", authorization.context.public_send(attribute))
21
21
  end
22
22
 
23
23
  self.action = action
@@ -1,3 +1,3 @@
1
1
  module PermissionPolicy
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -3,7 +3,8 @@ module PermissionPolicy
3
3
  RSpec.describe BaseStrategy do
4
4
 
5
5
  context 'valid' do
6
- let(:authorization) { double('authorization', preconditions: [:current_user], current_user: 'me') }
6
+ let(:context) { double('context', current_user: 'me') }
7
+ let(:authorization) { double('authorization', preconditions: [:current_user], context: context) }
7
8
  let(:action) { :foo }
8
9
  let(:options) { { something: 'nice' } }
9
10
 
@@ -24,4 +25,4 @@ module PermissionPolicy
24
25
 
25
26
  end
26
27
  end
27
- end
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: permission_policy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Schaden
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-06 00:00:00.000000000 Z
12
+ date: 2015-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport