pundit_roles 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/lib/pundit_roles/version.rb +1 -1
- data/pundit_roles.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9d41f133e02bb2d62751987d703e9f1df6626ee
|
4
|
+
data.tar.gz: 1ca3ac5b8b5dbba131c29417e45e6fc62f154d55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 456ee73a9e3145e0d2ca12daa6c65507a35a4eceff7f1e5aaba438a0a7784b0847edf33c1dc0c7ae01ed129879b1005ae5e34f146db482d5a792da0e25348ee6
|
7
|
+
data.tar.gz: 401da8afe1459ddb0b6dc36a9cfbea9b44ff2fdb165c9ff1d7b7fd459fb29837e4b81a2268ec3039732359adcb0ed181f9c6cf1a721629ed384f1c260121a2bb
|
data/README.md
CHANGED
@@ -17,8 +17,6 @@ appreciates the work that they did with their great authorization system.
|
|
17
17
|
|
18
18
|
* **Important**: This gem is **not** yet considered production ready.
|
19
19
|
|
20
|
-
* [**_Changelog_**](https://github.com/StairwayB/pundit_roles/blob/master/CHANGELOG.md)
|
21
|
-
|
22
20
|
## Installation
|
23
21
|
|
24
22
|
Add this line to your application's Gemfile:
|
@@ -49,6 +47,7 @@ falls into this role. Additionally, each role can have a set of permitted
|
|
49
47
|
_**attributes**_ and _**associations**_(from here on collectively referred to as _**options**_)
|
50
48
|
defined for it. A basic example for a UserPolicy would be:
|
51
49
|
```ruby
|
50
|
+
class UserPolicy < ApplicationPolicy
|
52
51
|
role :regular_user,
|
53
52
|
attributes: {
|
54
53
|
show: %i(username name avatar is_confirmed created_at)
|
@@ -66,12 +65,13 @@ role :correct_user,
|
|
66
65
|
show: %i(settings),
|
67
66
|
save: %i(settings)
|
68
67
|
}
|
68
|
+
end
|
69
69
|
```
|
70
70
|
|
71
71
|
This assumes that there are two methods defined in the UserPolicy called `regular_user?` and
|
72
72
|
`correct_user?`.
|
73
73
|
|
74
|
-
* Please note, that there was a breaking change since `0.1.2`. View the changelog for additional details.
|
74
|
+
* Please note, that there was a breaking change since `0.1.2`. View the [changelog](https://github.com/StairwayB/pundit_roles/blob/master/CHANGELOG.md) for additional details.
|
75
75
|
|
76
76
|
And then in you query method, you simply say:
|
77
77
|
```ruby
|
@@ -133,6 +133,8 @@ role :regular_user,
|
|
133
133
|
attributes: {show: [:name]},
|
134
134
|
associations: {show: [:posts]}
|
135
135
|
|
136
|
+
private
|
137
|
+
|
136
138
|
def regular_user?
|
137
139
|
@user.present?
|
138
140
|
end
|
@@ -307,7 +309,6 @@ generators, and possibly rspec helpers.
|
|
307
309
|
|
308
310
|
Bug reports are welcome on GitHub at [StairwayB](https://github.com/StairwayB/pundit_roles).
|
309
311
|
|
310
|
-
|
311
312
|
## License
|
312
313
|
|
313
314
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/lib/pundit_roles/version.rb
CHANGED
data/pundit_roles.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Daniel Balogh"]
|
10
10
|
spec.email = ["danielferencbalogh@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{Extends Pundit with roles,
|
13
|
-
spec.description = %q{Extends Pundit with roles}
|
12
|
+
spec.summary = %q{Extends Pundit with roles, allowing attribute and association level authorizations}
|
13
|
+
spec.description = %q{Extends Pundit with roles, allowing attribute and association level authorizations}
|
14
14
|
spec.homepage = "https://github.com/StairwayB/pundit_roles"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pundit_roles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Balogh
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.1.0
|
41
|
-
description: Extends Pundit with roles
|
41
|
+
description: Extends Pundit with roles, allowing attribute and association level authorizations
|
42
42
|
email:
|
43
43
|
- danielferencbalogh@gmail.com
|
44
44
|
executables: []
|
@@ -86,5 +86,5 @@ rubyforge_project:
|
|
86
86
|
rubygems_version: 2.6.11
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
|
-
summary: Extends Pundit with roles,
|
89
|
+
summary: Extends Pundit with roles, allowing attribute and association level authorizations
|
90
90
|
test_files: []
|