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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f220c1b6b47d2c4ec04c717591243c0256a5870f5802005a38a4c451104ea574
4
- data.tar.gz: 68dba463fa3ece4365ee47c3443ea859aac01b010b001c67a6419e61e910efdc
3
+ metadata.gz: c103819ff5b91d66f0f956545f2b0c1366e4ff076f953370e34e2e4c3685c099
4
+ data.tar.gz: f8094eb993fff840aac16397516ecaff77f121cecd09d654f7b3316113199b45
5
5
  SHA512:
6
- metadata.gz: 23f50653976ef276868f2c4bb0bcce1fd71582b424da461345138cb04bcc25c8cd75cdda2b5b66a2474536f3474535f5fa7780f5ae3618d4407b3e020f3dc14a
7
- data.tar.gz: ba64376d6c05184036cdb550ed39229485105af12f95f78132756893131bbf4a9fa7eeb2c67d865659c2ea10ad1fee53be01397652ddf0f237cd7ab51a689c82
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)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ez
4
4
  module Permissions
5
- VERSION = '0.4.3'
5
+ VERSION = '0.4.4'
6
6
  end
7
7
  end
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.3
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-03-20 00:00:00.000000000 Z
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.0.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.