thecore_auth_commons 3.0.7 → 3.0.8

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: 0cd52f88583bd526c64a26eafe79e9f246766714f8d48b28a894ba885cc7d22a
4
- data.tar.gz: 90003d281f2247e26b922b7fa8bfb8d8d63dc03e44c6151646ae6d172af8fabf
3
+ metadata.gz: 75d0bbf1a944e7f52195db777f70851d15e322254269833c5f8ded7724830011
4
+ data.tar.gz: 41ca8475384a8f92f099b9c7d4280274bc03816b8adc11cc23a50e1ed595a067
5
5
  SHA512:
6
- metadata.gz: 5565d62ec1ea44e874757af506cdeedf81d129cc8638442ede6171994f6d6bdc999131080d75f10c7a41cbf5d23914d3917e2dc88f826d13cfb0f60fc1ff5321
7
- data.tar.gz: 84a0577201c562fd5112db9a04085d3eca695718b5738ca3b0d635c1a9f77a73aff7658b8fdcb3e0a38120f377859cc9fcc252370198714b06220b1a0ef2ba66
6
+ metadata.gz: b95b8a2188480dd5beea0ea52d994bd57e1f4b7087b258cc554e21f3cef44db4399549aabfacb9cdbe3216b48a27a2af26482569bfb6d1e9883957ca72fd1329
7
+ data.tar.gz: b8f70c1756c9e9399ee1953ae4e47c34d81c299c4a2f5f1500c132c9360a0b2064f5a7f8792fb374630b56e77cb10cc843d14d30cbf1e14da88e2ed150f03d0e
@@ -1,14 +1,7 @@
1
1
  module ThecoreAuthCommonsUserConcern
2
2
  extend ActiveSupport::Concern
3
3
 
4
- included do
5
- before_validation on: :create do
6
- # If the generated uuid is not already present, then create the user with the proposed uuid
7
- # Otherwise, try to generate another one
8
- begin
9
- self.access_token = SecureRandom.uuid #urlsafe_base64(32)
10
- end while ::User.exists?(access_token: self.access_token)
11
- end
4
+ included do
12
5
  # REFERENCES
13
6
  has_many :role_users, dependent: :destroy, inverse_of: :user
14
7
  has_many :roles, through: :role_users, inverse_of: :users
@@ -17,7 +10,6 @@ module ThecoreAuthCommonsUserConcern
17
10
  validates :password, presence: true, on: :create
18
11
  validates :password_confirmation, presence: true, on: :create
19
12
  validate :check_password_and_confirmation_equal
20
- validates :access_token, uniqueness: true
21
13
  validates_each :admin do |record, attr, value|
22
14
  # Don't want admin == false if the current user is the only admin
23
15
  record.errors.add(attr, I18n.t("validation.errors.cannot_unadmin_last_admin")) if record.admin_changed? && record.admin_was == true && User.where(admin: true).count == 1
data/db/seeds.rb CHANGED
@@ -6,7 +6,6 @@ unless User.where(admin: true).exists?
6
6
  u = User.find_or_initialize_by(email: email)
7
7
  u.username = "Administrator" if u.respond_to? :username=
8
8
  u.password = u.password_confirmation = psswd
9
- u.encrypted_access_token = User.new(:password => SecureRandom.uuid).encrypted_password
10
9
  u.admin = true
11
10
  u.save(validate: false)
12
11
  end
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.7
4
+ version: 3.0.8
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-11 00:00:00.000000000 Z
11
+ date: 2023-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise
@@ -194,7 +194,6 @@ files:
194
194
  - db/migrate/20160209153229_add_admin_to_user.rb
195
195
  - db/migrate/20160209153326_add_lock_version_to_user.rb
196
196
  - db/migrate/20160209153406_add_locked_to_user.rb
197
- - db/migrate/20160209153533_add_access_token_to_user.rb
198
197
  - db/migrate/20160209153811_create_roles.rb
199
198
  - db/migrate/20160209153813_create_role_users.rb
200
199
  - db/migrate/20160209153816_create_permissions_chain.rb
@@ -1,5 +0,0 @@
1
- class AddAccessTokenToUser < ActiveRecord::Migration[7.0]
2
- def change
3
- add_column :users, :encrypted_access_token, :string, if_not_exists: true
4
- end
5
- end