effective_roles 2.3.2 → 2.4.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: 9bfa0c4c2878a1c88ee466c2cc321ad1ad8016adf44b521d710b81f11bda17d1
4
- data.tar.gz: bb370586b9e8ff441156be67dcc9b296c7a445602100a8d571b49db406ee9300
3
+ metadata.gz: c69a70691f07ea3a230ae228c8565d7b19dbf6d0a763e525c54d2cbfb11232b2
4
+ data.tar.gz: f4824b2d42940c9b6dc77b43034072e039f542c0a6bb666cde104d7dcbd3ed73
5
5
  SHA512:
6
- metadata.gz: 85b549b0bddf0e29f1ac29eb37b49a227f49a6d8fd44396c727bc47c067e6ecb9f9297f4f5cf1f4ae274ac96b7bdd7aad6a59a8453dd2b46ca748d6f5585e44d
7
- data.tar.gz: 45c5c8fd2a446bec85814198e8e609e67011758ddac0f2d8529ef8854f2a4b51d4a389f39f9f72ad7614c738f675b9bbc366901217bb94e50e8a98e4427e1f17
6
+ metadata.gz: d8be49a02fcb6ce1e16a5700a3a5c4e3d8cc971391612427a466158b2ae3cf526bc99810207196fc014eaaaa18b7723165fe260716700020af3df4281882eac8
7
+ data.tar.gz: e850cf95ecb6e75d4b052d78368d65a354910c774cdeeba1be866c8cf60b65f9672f2bfba7572460dbeb94e94e5d20e7589c7563d4945454a40caea53b1a5ed9
@@ -98,8 +98,8 @@ module ActsAsRoleRestricted
98
98
  end
99
99
 
100
100
  def add_role(role)
101
- raise('expected role to be a symbol') unless role.kind_of?(Symbol)
102
- raise('unknown role') unless EffectiveRoles.roles_mask_for(role) > 0
101
+ raise("expected role to be a symbol but got #{role || 'nil'}") unless role.kind_of?(Symbol)
102
+ raise("unknown role :#{role}") unless EffectiveRoles.roles_mask_for(role) > 0
103
103
 
104
104
  assign_attributes(roles: roles | [role])
105
105
  end
@@ -109,8 +109,8 @@ module ActsAsRoleRestricted
109
109
  end
110
110
 
111
111
  def remove_role(role)
112
- raise('expected role to be a symbol') unless role.kind_of?(Symbol)
113
- raise('unknown role') unless EffectiveRoles.roles_mask_for(role) > 0
112
+ raise("expected role to be a symbol but got #{role || 'nil'}") unless role.kind_of?(Symbol)
113
+ raise("unknown role :#{role}") unless EffectiveRoles.roles_mask_for(role) > 0
114
114
 
115
115
  assign_attributes(roles: roles - [role])
116
116
  end
@@ -121,8 +121,8 @@ module ActsAsRoleRestricted
121
121
 
122
122
  # if user.is? :admin
123
123
  def is?(role)
124
- raise('expected role to be a symbol') unless role.kind_of?(Symbol)
125
- raise('unknown role') unless EffectiveRoles.roles_mask_for(role) > 0
124
+ raise("expected role to be a symbol but got #{role || 'nil'}") unless role.kind_of?(Symbol)
125
+ raise("unknown role :#{role}") unless EffectiveRoles.roles_mask_for(role) > 0
126
126
 
127
127
  roles.include?(role)
128
128
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveRoles
2
- VERSION = '2.3.2'.freeze
2
+ VERSION = '2.4.0'.freeze
3
3
  end
@@ -59,7 +59,7 @@ module EffectiveRoles
59
59
  next if disabled && skip_disabled
60
60
 
61
61
  [
62
- "#{role}<p class='help-block text-muted'>#{role_description(role, resource)}</p>".html_safe,
62
+ "#{role}<small class='form-text text-muted'>#{role_description(role, resource)}</small>".html_safe,
63
63
  role,
64
64
  ({:disabled => :disabled} if disabled)
65
65
  ]
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.3.2
4
+ version: 2.4.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: 2022-07-28 00:00:00.000000000 Z
11
+ date: 2023-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails