ez-permissions 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/ez/permissions/api/models.rb +9 -0
- data/lib/ez/permissions/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c103819ff5b91d66f0f956545f2b0c1366e4ff076f953370e34e2e4c3685c099
|
4
|
+
data.tar.gz: f8094eb993fff840aac16397516ecaff77f121cecd09d654f7b3316113199b45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75e8986de02432aa15c5135fa5821ca390daf446f4dfcef6c936bb3708179798b8b964138ce406142516fc0042aabed6516840fab1440318741973826d04e17b
|
7
|
+
data.tar.gz: 2eb3c3a15fb6e31dc47dccc28ffba3482a53d5face7757ed3f4269112346f5f739c6968d6cebbc2c71fe089c3c64a4b291a6ed15993ff713e2da8877dc649e08
|
data/README.md
CHANGED
@@ -146,6 +146,10 @@ Permissions.includes_role?(user, :admin)
|
|
146
146
|
# Check if user includes scoped role
|
147
147
|
project = Project.first
|
148
148
|
Permissions.includes_role?(user, :manager, scoped: project)
|
149
|
+
|
150
|
+
# List users with particular role in particular scope
|
151
|
+
project = Project.first
|
152
|
+
Permissions.list_by_role(:manager, scoped: project)
|
149
153
|
```
|
150
154
|
|
151
155
|
### Permissions
|
@@ -26,6 +26,15 @@ module Ez
|
|
26
26
|
model_role(role, model, scoped) ? true : false
|
27
27
|
end
|
28
28
|
|
29
|
+
def list_by_role(role_name, scoped: nil)
|
30
|
+
role = Ez::Permissions::API.get_role!(role_name)
|
31
|
+
|
32
|
+
Ez::Permissions::ModelRole.where(
|
33
|
+
role: role,
|
34
|
+
scoped: scoped
|
35
|
+
).map(&:model)
|
36
|
+
end
|
37
|
+
|
29
38
|
private
|
30
39
|
|
31
40
|
def model_role(role, model, scoped)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ez-permissions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Volodya Sveredyuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ez-core
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
- !ruby/object:Gem::Version
|
209
209
|
version: '0'
|
210
210
|
requirements: []
|
211
|
-
rubygems_version: 3.
|
211
|
+
rubygems_version: 3.1.2
|
212
212
|
signing_key:
|
213
213
|
specification_version: 4
|
214
214
|
summary: Easy permissions engine for Rails app.
|