thecore_auth_commons 3.0.11 → 3.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/permission.rb +3 -3
- data/db/seeds.rb +6 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6dc9f1f0db9ab039eab12d3e36123f6dee5a48e091c9f073145644e6a51d3ba
|
4
|
+
data.tar.gz: 6bafa20751078ada406524b835a66cb080e0b69996e3a1535e6fdceafb12aceb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91dcaf23c0f4b6afe6ead816d7200b2861dc263c5b5e5afd3487d833baf6f1201bdcec6ad9760f5ff0af0450c5b5b9af4e6ca20a0b28e7d36d9d28dda950f1e4
|
7
|
+
data.tar.gz: 46dfc5d249450c5e56049c4670641533749cf2c6c7506eb4e5452e92b8492f8f2d61ef5be72f6c42953fdbcb222415f3109c030515c95e172c1909fd8fa0915f
|
data/app/models/permission.rb
CHANGED
@@ -12,9 +12,9 @@ class Permission < ApplicationRecord
|
|
12
12
|
validates :target_id, presence: true
|
13
13
|
|
14
14
|
def display_name
|
15
|
-
|
15
|
+
pr = (I18n.t "permissions.predicates.#{predicate.name}", default: predicate.name.titleize rescue nil)
|
16
16
|
a = (I18n.t "permissions.actions.#{action.name}", default: action.name.titleize rescue nil)
|
17
|
-
m = (I18n.t "activerecord.models.#{target.name}", default: target.name.titleize rescue nil)
|
18
|
-
[
|
17
|
+
m = (I18n.t "activerecord.models.#{target.name}", count: 2, default: target.name.titleize rescue nil)
|
18
|
+
[ pr, a, m ].join(" ")
|
19
19
|
end
|
20
20
|
end
|
data/db/seeds.rb
CHANGED
@@ -12,13 +12,17 @@ end
|
|
12
12
|
@values = {
|
13
13
|
predicates: %i[can cannot],
|
14
14
|
actions: %i[manage create read update destroy],
|
15
|
-
targets: ApplicationRecord.subclasses.map {|d| d.to_s.underscore}.to_a.unshift(
|
15
|
+
targets: ApplicationRecord.subclasses.map {|d| d.to_s.underscore}.to_a.unshift("all")
|
16
16
|
}
|
17
17
|
|
18
18
|
def fill table
|
19
19
|
model = table.to_s.classify.constantize
|
20
20
|
model.reset_column_information
|
21
|
-
|
21
|
+
puts " - Filling table #{table} with #{@values[table].count} elements:"
|
22
|
+
@values[table].each do |name|
|
23
|
+
puts " - Name: #{name}"
|
24
|
+
model.find_or_create_by name: name
|
25
|
+
end
|
22
26
|
end
|
23
27
|
|
24
28
|
fill :predicates
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_auth_commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
225
|
- !ruby/object:Gem::Version
|
226
226
|
version: '0'
|
227
227
|
requirements: []
|
228
|
-
rubygems_version: 3.4.
|
228
|
+
rubygems_version: 3.4.10
|
229
229
|
signing_key:
|
230
230
|
specification_version: 4
|
231
231
|
summary: Common Auth methods and models to be used in thecore components.
|