effective_roles 2.1.1 → 2.2.0

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: 2839a8a58a284f7b6f9f7b12a3d5a0eff69b9b60c1f99ef68d364acab5257355
4
- data.tar.gz: 69856eb8d9e3296a26386d28560c36c238cbfc7d407168f2614f13f48fc9b9eb
3
+ metadata.gz: 77423c072ab8659b9e632cebcd9fe939743abac4d0b374f12b3e144a70bcdfe1
4
+ data.tar.gz: 929bbf885819e6303f7a09ffe7c58988f4607403903b3dfdc3c141f175714eee
5
5
  SHA512:
6
- metadata.gz: e7c8c3befff4c7f7c51290f39f8f14a70ce50cca7448be66869875bca53422d23b73ef5b558b58ebc046b66f398d356d2fa3125bc595b9ecad737eb16a06d41d
7
- data.tar.gz: c504136f2a6593dd272ce0208d72f26fb77a491e846c91b24ed5806a60aa4ffbea942ecb09e19e463166bbe0835e21071b7ac9493aecda527a479dc26c68c054
6
+ metadata.gz: a6917b11179747ff215fd926a595594de592b6881a3ca74c7b699fb52a1a0b482259ff2edddd0cd02d2eaebf8d265ebea506128641d32fb7f296567bad2466bf
7
+ data.tar.gz: 90a7d053382163c74cf8df9dee3d03b84239f4f39bd199d1b0ada04f124fd88b8ff4d7222dd8e3fce9f0eb37544c2bf386ab0a0d8c3a38ee9384b6b04b861907
@@ -29,7 +29,7 @@ module ActsAsRoleRestricted
29
29
 
30
30
  validates :roles_mask, numericality: true, allow_nil: true
31
31
 
32
- validate(if: -> { changes.include?(:roles_mask) && EffectiveRoles.assignable_roles_present?(self) }) do
32
+ validate(if: -> { changes.include?(:roles_mask) && EffectiveRoles.assignable_roles_present?(self) && current_user.present? }) do
33
33
  roles_was = EffectiveRoles.roles_for(changes[:roles_mask].first)
34
34
  changed = (roles + roles_was) - (roles & roles_was) # XOR
35
35
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveRoles
2
- VERSION = '2.1.1'.freeze
2
+ VERSION = '2.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_roles
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-18 00:00:00.000000000 Z
11
+ date: 2021-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails