access-granted 1.1.0 → 1.1.1

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: 62c9307deb8d9c208a9934214e56999b093c017b
4
- data.tar.gz: 74049e46c543d0015f565c96236ddc7b7fd7bea6
3
+ metadata.gz: 6623e9733f5b953552e36a15583df6521907ec6e
4
+ data.tar.gz: bafd828d949b9c72c0f5bf02e35059d4454abfe2
5
5
  SHA512:
6
- metadata.gz: c15fffc2c35008b3e0dee3b758827c483ea12bcacc3eb0f9fabfec61004dd1929c92210846bb6a1ec0c0c66dab1b78c0d087f2d096d822f48f50519661f5a558
7
- data.tar.gz: 70d741d7ed4606a3b1309e6a1b1a8ffdf84c0624c6040cb7e56cc6882c1dfbccbc533e65ac035b99ee695f33392059865e07fa694dc480e19913a4a25dd671d2
6
+ metadata.gz: 3ca707e303b4d873afe1b1a7faa5a1d342ca41b42fd866aba43a04313bffd2f56ea8db286d4aeed79e574d463acd1d1ec2f7823b320368cf0b22575df3873bc0
7
+ data.tar.gz: 24a03ef14f3283028ec7552c30e4bd2dc1d7688aed840d610c3f017cf7f233b303012876224eda1a3c64e233ad83de35b113a41b6ae7317b11d84229ce465e02
@@ -5,7 +5,6 @@ rvm:
5
5
  - 2.0
6
6
  - 2.1
7
7
  - 2.2
8
- - 2.3
9
8
  - rbx-2
10
9
  - rbx
11
10
  - jruby-1
@@ -0,0 +1,3 @@
1
+ # 1.1.1
2
+
3
+ - Return detailed information about which permission is duplicate when raising DuplicatePermission exception
data/README.md CHANGED
@@ -11,12 +11,16 @@ AccessGranted is a multi-role and whitelist based authorization gem for Rails. A
11
11
  Add the gem to your gemfile:
12
12
 
13
13
  ```ruby
14
- gem 'access-granted', '~> 1.0.0'
14
+ gem 'access-granted', '~> 1.1.0'
15
15
  ```
16
16
  Run the bundle command to install it. Then run the generator:
17
17
 
18
18
  rails generate access_granted:policy
19
19
 
20
+ Add the `policies` (and `roles` if you're using it to split up your roles into files) directories to your autoload paths in `application.rb`:
21
+
22
+ config.autoload_paths += %W(#{config.root}/app/policies #{config.root}/app/roles)
23
+
20
24
  ### Supported Ruby versions
21
25
 
22
26
  Because it has **zero** runtime dependencies it is guaranteed to work on all major Ruby versions MRI 1.9.3-2.2, Rubinius >= 2.X and JRuby >= 1.7.
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "access-granted"
7
- spec.version = "1.1.0"
7
+ spec.version = "1.1.1"
8
8
  spec.authors = ["Piotrek Okoński"]
9
9
  spec.email = ["piotrek@okonski.org"]
10
10
  spec.description = %q{Role based authorization gem}
@@ -54,7 +54,7 @@ module AccessGranted
54
54
 
55
55
  def add_permission(granted, action, subject, conditions, block)
56
56
  prepare_actions(action).each do |a|
57
- raise DuplicatePermission if find_permission(a, subject)
57
+ raise DuplicatePermission, "Permission `#{a}` is already defined for #{subject} in role `#{name}`" if find_permission(a, subject)
58
58
  permissions << Permission.new(granted, a, subject, @user, conditions, block)
59
59
  end
60
60
  end
@@ -49,7 +49,7 @@ describe AccessGranted::Role do
49
49
 
50
50
  it "forbids creating actions with the same name" do
51
51
  @role.can :read, String
52
- expect { @role.can :read, String }.to raise_error AccessGranted::DuplicatePermission
52
+ expect { @role.can :read, String }.to raise_error AccessGranted::DuplicatePermission, "Permission `read` is already defined for String in role `member`"
53
53
  end
54
54
 
55
55
  it "accepts :manage shortcut for CRUD actions" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: access-granted
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotrek Okoński
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-03 00:00:00.000000000 Z
11
+ date: 2016-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -48,6 +48,7 @@ files:
48
48
  - ".gitignore"
49
49
  - ".rspec"
50
50
  - ".travis.yml"
51
+ - CHANGELOG.md
51
52
  - Gemfile
52
53
  - LICENSE.txt
53
54
  - README.md
@@ -89,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  version: '0'
90
91
  requirements: []
91
92
  rubyforge_project:
92
- rubygems_version: 2.4.5.1
93
+ rubygems_version: 2.5.1
93
94
  signing_key:
94
95
  specification_version: 4
95
96
  summary: Elegant whitelist and role based authorization with ability to prioritize
@@ -100,3 +101,4 @@ test_files:
100
101
  - spec/policy_spec.rb
101
102
  - spec/role_spec.rb
102
103
  - spec/spec_helper.rb
104
+ has_rdoc: