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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eec76cb6a0c306c0bdc7277b486a1055b9e394b93d8b0568cdb4e071738ffc68
4
- data.tar.gz: 31c8bac34e2a469a8326e9ea30a2fa33209784decb5d89b6c1483f4ecad130b2
3
+ metadata.gz: b6dc9f1f0db9ab039eab12d3e36123f6dee5a48e091c9f073145644e6a51d3ba
4
+ data.tar.gz: 6bafa20751078ada406524b835a66cb080e0b69996e3a1535e6fdceafb12aceb
5
5
  SHA512:
6
- metadata.gz: 3349f5fec0ed5cc9453f85478d87b17e715b7333552afd2910e8ff14559eaf4c5adca7817a889ef6132dda6b937b500353ea12132e0b6a0000b35f93eedbcd29
7
- data.tar.gz: 2b8e48d9241cd292a30ba5dca89c416939ebc6afb37694bca1fcb64b4471288d70b6ab9054def1d84b51253772946c9eab3c618c6ec15bb0ce950ee575ea68fe
6
+ metadata.gz: 91dcaf23c0f4b6afe6ead816d7200b2861dc263c5b5e5afd3487d833baf6f1201bdcec6ad9760f5ff0af0450c5b5b9af4e6ca20a0b28e7d36d9d28dda950f1e4
7
+ data.tar.gz: 46dfc5d249450c5e56049c4670641533749cf2c6c7506eb4e5452e92b8492f8f2d61ef5be72f6c42953fdbcb222415f3109c030515c95e172c1909fd8fa0915f
@@ -12,9 +12,9 @@ class Permission < ApplicationRecord
12
12
  validates :target_id, presence: true
13
13
 
14
14
  def display_name
15
- p = (I18n.t "permissions.predicates.#{predicate.name}", default: predicate.name.titleize rescue nil)
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
- [ p, a, m ].join(" ")
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(:all)
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
- model.upsert_all @values[table].map { |p| {name: p, created_at: Time.now, updated_at: Time.now} }, unique_by: [:name]
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.11
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-02-16 00:00:00.000000000 Z
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.6
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.