effective_roles 1.4.3 → 1.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
  SHA1:
3
- metadata.gz: 0008cff5d883db3f4b297653d083c5d189efad97
4
- data.tar.gz: 91640687e9b387abfd09680d1f3812743e501ebb
3
+ metadata.gz: 2dcace94c980b6d3d8ca8e2e3a89ff62ddf29048
4
+ data.tar.gz: 2c67c15ec721d5e346095ed9bcab84b12af3500e
5
5
  SHA512:
6
- metadata.gz: 1ed90b01364f7966d6f628e6779a0ddb302d0d42a5ee3c2a9b6ccada42599be8dd353cf514eb84f611bdf9be874d40f9bc9274ac2e5b18cafebda162ce7cb1a8
7
- data.tar.gz: bb536a4f8677cc5a619d4a7a816b97ca11eb1b3341ce7d971c04fc605abbf2ed17d727b74b75bb03abd702f641ff117e1f8abd884c585efb31c9886f665c7273
6
+ metadata.gz: f88182a9352373f99b95eef827fcb827a642e866cda029c5fb29caf9a1680c2aa6b089321295f853d541e0d2f452987687b8ee7992f52e6134cfae5e9bcb2423
7
+ data.tar.gz: b6ba9bb14af5d0bba32135aacc92955dffb5d3498d88884da0f095b29b37d675c8aeed00c4301729637b409fe37d1181f6c9a98104c40a532c18c67300f315f6
data/README.md CHANGED
@@ -83,7 +83,7 @@ All roles are defined in the config/effective_roles.rb initializer. The roles a
83
83
  Assign roles:
84
84
 
85
85
  ```ruby
86
- post.roles = [:admin, :superamdin]
86
+ post.roles = [:admin, :superadmin]
87
87
  post.save
88
88
  ```
89
89
 
@@ -57,7 +57,9 @@ module ActsAsRoleRestricted
57
57
 
58
58
  roles = (roles.map { |role| role.to_sym } & EffectiveRoles.roles)
59
59
 
60
- where(roles.map { |role| "NOT(#{self.table_name}.roles_mask & %d > 0)" % 2**EffectiveRoles.roles.index(role) }.join(' AND '))
60
+ where(
61
+ roles.map { |role| "NOT(#{self.table_name}.roles_mask & %d > 0)" % 2**EffectiveRoles.roles.index(role) }.join(' AND ')
62
+ ).or(where(roles_mask: nil))
61
63
  end
62
64
  end
63
65
 
@@ -53,7 +53,7 @@ module EffectiveRoles
53
53
  def self.roles_collection(obj = nil, user = nil)
54
54
  assignable_roles_for(user, obj).map do |role|
55
55
  [
56
- "#{role}<p class='help-block'>#{role_description(role, obj)}</p>".html_safe,
56
+ "#{role}<p class='help-block text-muted'>#{role_description(role, obj)}</p>".html_safe,
57
57
  role,
58
58
  ({:disabled => :disabled} if disabled_roles_for(obj).include?(role))
59
59
  ]
@@ -4,13 +4,6 @@ module EffectiveRoles
4
4
 
5
5
  config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
6
6
 
7
- # Include Helpers to base application
8
- initializer 'effective_roles.action_controller' do |app|
9
- ActiveSupport.on_load :action_controller do
10
- helper EffectiveRolesHelper
11
- end
12
- end
13
-
14
7
  # Include acts_as_addressable concern and allow any ActiveRecord object to call it
15
8
  initializer 'effective_roles.active_record' do |app|
16
9
  ActiveSupport.on_load :active_record do
@@ -1,3 +1,3 @@
1
1
  module EffectiveRoles
2
- VERSION = '1.4.3'.freeze
2
+ VERSION = '1.4.4'.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: 1.4.3
4
+ version: 1.4.4
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: 2017-04-18 00:00:00.000000000 Z
11
+ date: 2018-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails