effective_roles 2.7.1 → 2.8.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: 8c1f1f6b5dd1700dcaa93ac9b8f57ffbdd20a131be00bded8702b5f07fa65f30
4
- data.tar.gz: c1e9fca0b2f63631519bd7a2f3cae7c5ff8ca3bb51e867a163f4f8830f511190
3
+ metadata.gz: 592048e729650a2988a1b4cd6a88982f74798715385cac9d17f80fd5c975b197
4
+ data.tar.gz: f0dbc94accae4749fa9fea221cf7f0ffc7013463ddd3571e68c64789bed554b5
5
5
  SHA512:
6
- metadata.gz: f00b6ad97bef4ec78ebc2b14b80e2ac0c3433e7bbda3cc40904339e0029af67e2bd90fd17f66e2ee71a2dc74f04432a9fddbad48074cd854affcd7b5e3d6db68
7
- data.tar.gz: f3113726bb54b14fcf9c4a0224e82c504fb9854a138d79f3b5fd664aa0e4e2c7ec8e92e1483f3ac9834307f5e7d0a7cf87fc68bbdd9aea1dad052354ca4af069
6
+ metadata.gz: 38b3e7b0aa680d4e47ea1d2411bb3a7c77a5c5155e6f6702b5ee14b14cc48b51bd0497e26c780a5f9fa4aec88cc0cab12da8bc5936cc5def8d44bde29a8f7693
7
+ data.tar.gz: 608cd0e64ecc94c77daba4c559f4b22fa6eb18b8515a33695f87da051dadd72f16b91c1bf6b76a05b457fe2cfb1c1e6e965e1f2d0c76077fc70f7297b75742b4
@@ -1,3 +1,3 @@
1
1
  module EffectiveRoles
2
- VERSION = '2.7.1'.freeze
2
+ VERSION = '2.8.0'.freeze
3
3
  end
@@ -44,7 +44,7 @@ module EffectiveRoles
44
44
  (role_colors || {})[role]
45
45
  end
46
46
 
47
- def self.roles_collection(resource, current_user = nil, only: nil, except: nil, multiple: nil, skip_disabled: nil)
47
+ def self.roles_collection(resource, current_user = nil, only: nil, except: nil, skip_disabled: nil)
48
48
  if assignable_roles.present?
49
49
  raise('expected object to respond to is_role_restricted?') unless resource.respond_to?(:is_role_restricted?)
50
50
  raise('expected current_user to respond to is_role_restricted?') if current_user && !current_user.respond_to?(:is_role_restricted?)
@@ -52,11 +52,12 @@ module EffectiveRoles
52
52
 
53
53
  only = Array(only).compact
54
54
  except = Array(except).compact
55
- multiple = resource.acts_as_role_restricted_options[:multiple] if multiple.nil?
56
- assignable = assignable_roles_collection(resource, current_user, multiple: multiple)
57
55
  skip_disabled = assignable_roles.kind_of?(Hash) if skip_disabled.nil?
58
56
 
59
- roles.map do |role|
57
+ all_roles = assignable_roles_collection(resource)
58
+ assignable = assignable_roles_collection(resource, current_user)
59
+
60
+ all_roles.map do |role|
60
61
  next if only.present? && !only.include?(role)
61
62
  next if except.present? && except.include?(role)
62
63
 
@@ -71,7 +72,7 @@ module EffectiveRoles
71
72
  end.compact
72
73
  end
73
74
 
74
- def self.assignable_roles_collection(resource, current_user = nil, multiple: nil)
75
+ def self.assignable_roles_collection(resource, current_user = nil)
75
76
  return roles unless assignable_roles_present?(resource)
76
77
 
77
78
  if current_user && !current_user.respond_to?(:is_role_restricted?)
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.7.1
4
+ version: 2.8.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: 2024-04-17 00:00:00.000000000 Z
11
+ date: 2024-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails