ez-permissions 0.6.0 → 0.6.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
  SHA256:
3
- metadata.gz: bc03e8e58f184793c6e903393db062e06d8a8887fe4887f455807d4c624cbaa0
4
- data.tar.gz: f6b5695a2a45a9908846b72b09c75455605cc28d25583cdc8439c14a8479a538
3
+ metadata.gz: 5514714fbd59dcc2567a76cf7170c88ba2493ad654aa232ee464b386d7d73ca9
4
+ data.tar.gz: 988f18fad5072711f3699cbd78386647822745975314ef57bb6ab4848ea66cf6
5
5
  SHA512:
6
- metadata.gz: 76ab990a4c789b1da51a2265ec5af08f4fad689a5a958be1b947c4cff33e7cd18dfe035f4a375f0fa8df616481dbf2401273d6eba36164a1cdae844ea6925852
7
- data.tar.gz: 995f632e48f0bc79d6785cd7ad27fea4e9b6bf36c7aace149729d573ab25aa0f0b16d6a7bce39fa38f33ae50b3a6d9fe994d8785452890823a58f45efc65e097
6
+ metadata.gz: 547ec67bb10c87d4d4b6c04258d1491afaa8cd1f4c85b17403502d82b29fc7574b2f96c2327d12064be5dd0385cc6cfc4395b635a9c88bba2cb7a5f97d33d91a
7
+ data.tar.gz: a24ca354fd87426c2fee1aa94b660e410886288218dcb29dfe4439e68735a7b582ea2c2627d54c6d74ee1fa9efdc7d64eb26efeb489af409bb46f960168e5e1d
data/README.md CHANGED
@@ -31,7 +31,7 @@ Configuration interface allows you to change default behavior
31
31
  ```ruby
32
32
  Ez::Permissions.configure do |config|
33
33
  # If in generated migrations you changed table names, please configure them here:
34
- config.permission_table_name = 'my_permissions'
34
+ config.permissions_table_name = 'my_permissions'
35
35
  config.roles_table_name = 'my_roles'
36
36
  config.models_roles_table_name = 'my_model_roles'
37
37
  config.permissions_roles_table_name = 'my_permissions_roles'
@@ -7,16 +7,16 @@ module Ez
7
7
  def self.included(base)
8
8
  base.has_many :assigned_roles,
9
9
  class_name: 'Ez::Permissions::ModelRole',
10
- as: :model
10
+ as: :model
11
11
 
12
12
  base.has_many :roles,
13
13
  -> { distinct },
14
- through: :assigned_roles,
14
+ through: :assigned_roles,
15
15
  class_name: 'Ez::Permissions::Role'
16
16
 
17
17
  base.has_many :permissions,
18
18
  -> { distinct },
19
- through: :roles,
19
+ through: :roles,
20
20
  class_name: 'Ez::Permissions::Permission'
21
21
  end
22
22
  # rubocop:enable Metrics/MethodLength
@@ -53,9 +53,9 @@ module Ez
53
53
  permission_ids = Ez::Permissions::PermissionRole.where(role_id: role_ids).pluck(:permission_id)
54
54
 
55
55
  Ez::Permissions::Permission.where(
56
- id: permission_ids,
56
+ id: permission_ids,
57
57
  resource: resource,
58
- action: actions.map(&:to_s)
58
+ action: actions.map(&:to_s)
59
59
  )
60
60
  end
61
61
 
@@ -8,8 +8,8 @@ module Ez
8
8
  role = Ez::Permissions::API.get_role!(role_name)
9
9
 
10
10
  Ez::Permissions::ModelRole.find_or_create_by!(
11
- role: role,
12
- model: model,
11
+ role: role,
12
+ model: model,
13
13
  scoped: scoped
14
14
  )
15
15
  end
@@ -30,7 +30,7 @@ module Ez
30
30
  role = Ez::Permissions::API.get_role!(role_name)
31
31
 
32
32
  Ez::Permissions::ModelRole.where(
33
- role: role,
33
+ role: role,
34
34
  scoped: scoped
35
35
  ).map(&:model)
36
36
  end
@@ -39,8 +39,8 @@ module Ez
39
39
 
40
40
  def model_role(role, model, scoped)
41
41
  Ez::Permissions::ModelRole.find_by(
42
- role: role,
43
- model: model,
42
+ role: role,
43
+ model: model,
44
44
  scoped: scoped
45
45
  )
46
46
  end
@@ -28,7 +28,7 @@ module Ez
28
28
  permission = get_permission!(action, resource)
29
29
 
30
30
  Ez::Permissions::PermissionRole.find_by(
31
- role: role,
31
+ role: role,
32
32
  permission: permission
33
33
  )&.delete
34
34
  end
@@ -37,7 +37,7 @@ module Ez
37
37
 
38
38
  def grant_single_permission(role, permission)
39
39
  Ez::Permissions::PermissionRole.find_or_create_by!(
40
- role: role,
40
+ role: role,
41
41
  permission: permission
42
42
  )
43
43
  end
@@ -62,7 +62,7 @@ module Ez
62
62
  resource.actions.each do |action|
63
63
  Ez::Permissions::Permission.where(
64
64
  resource: resource.name,
65
- action: action
65
+ action: action
66
66
  ).first_or_create!
67
67
  end
68
68
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ez
4
4
  module Permissions
5
- VERSION = '0.6.0'
5
+ VERSION = '0.6.1'
6
6
  end
7
7
  end
@@ -8,7 +8,7 @@ module Ez
8
8
  "# frozen_string_literal: true
9
9
 
10
10
  Ez::Permissions.configure do |config|
11
- # config.permission_table_name = 'ez_permissions_permissions'
11
+ # config.permissions_table_name = 'ez_permissions_permissions'
12
12
  # config.roles_table_name = 'ez_permissions_roles'
13
13
  # config.models_roles_table_name = 'ez_permissions_model_roles'
14
14
  # config.permissions_roles_table_name = 'ez_permissions_permissions_roles'
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.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volodya Sveredyuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-01 00:00:00.000000000 Z
11
+ date: 2021-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ez-core