bullet_train-roles 1.6.2 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 60ec09c4f08c24e3d3ec9c0a408d6c43395d9088ac37402e89bda662f5c97d7a
|
|
4
|
+
data.tar.gz: 9cde4b9cf4e9d678cc3d294e23d067bb9cb6602efa7d3d11ec08bde4d21d956e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f7a33a5bc6b601f07d06f836a2dc529e69eec5dd6a45e9da247ed2ba4c97d4ec25af4e3f59cc91546310b69c8339308ad8cf542cc050e83350cb2f88d30bada9
|
|
7
|
+
data.tar.gz: c6cc4b869a353bb0855d6b30223a315fd433701b94f7ef7dccc107a40263052daccda5097459c2c730921c5d83ba8a9240b6bf4513824b08716d316c7ba7ef70
|
data/Gemfile.lock
CHANGED
data/lib/roles/support.rb
CHANGED
|
@@ -40,7 +40,7 @@ module Roles
|
|
|
40
40
|
# For example, if you do with_roles(editor) it will return admin users if the admin role includes the editor role
|
|
41
41
|
def self.with_roles(roles)
|
|
42
42
|
# Mysql and postgres have different syntax for searching json or jsonb columns so we need different queries depending on the database
|
|
43
|
-
|
|
43
|
+
mysql? ? with_roles_mysql(roles) : with_roles_postgres(roles)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def self.with_roles_mysql(roles)
|
|
@@ -56,6 +56,10 @@ module Roles
|
|
|
56
56
|
where("#{table_name}.role_ids ?| array[:keys]", keys: roles.map(&:key_plus_included_by_keys).flatten.uniq.map(&:to_s))
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
+
def self.mysql?
|
|
60
|
+
["mysql", "trilogy"].any? { |adapter| ActiveRecord::Base.connection.adapter_name.downcase.include?(adapter) }
|
|
61
|
+
end
|
|
62
|
+
|
|
59
63
|
def validate_roles
|
|
60
64
|
self.role_ids = role_ids&.select(&:present?) || []
|
|
61
65
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bullet_train-roles
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.6.
|
|
4
|
+
version: 1.6.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Prabin Poudel
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2023-10-
|
|
12
|
+
date: 2023-10-16 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: byebug
|