access-granted 1.1.0 → 1.1.1
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 +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +3 -0
- data/README.md +5 -1
- data/access-granted.gemspec +1 -1
- data/lib/access-granted/role.rb +1 -1
- data/spec/role_spec.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6623e9733f5b953552e36a15583df6521907ec6e
|
4
|
+
data.tar.gz: bafd828d949b9c72c0f5bf02e35059d4454abfe2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ca707e303b4d873afe1b1a7faa5a1d342ca41b42fd866aba43a04313bffd2f56ea8db286d4aeed79e574d463acd1d1ec2f7823b320368cf0b22575df3873bc0
|
7
|
+
data.tar.gz: 24a03ef14f3283028ec7552c30e4bd2dc1d7688aed840d610c3f017cf7f233b303012876224eda1a3c64e233ad83de35b113a41b6ae7317b11d84229ce465e02
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
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.
|
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.
|
data/access-granted.gemspec
CHANGED
@@ -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.
|
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}
|
data/lib/access-granted/role.rb
CHANGED
@@ -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
|
data/spec/role_spec.rb
CHANGED
@@ -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.
|
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-
|
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.
|
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:
|