thecore_auth_commons 3.0.5 → 3.0.7

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: 7e9c1cc8505cddf86bb6abc922c538a0d55fa571933b6158e078df3c89a477a5
4
- data.tar.gz: 751434de07685430512faf2ff6c970c5a6a1dde6ced7e536f1d65ad7ad0acf27
3
+ metadata.gz: 0cd52f88583bd526c64a26eafe79e9f246766714f8d48b28a894ba885cc7d22a
4
+ data.tar.gz: 90003d281f2247e26b922b7fa8bfb8d8d63dc03e44c6151646ae6d172af8fabf
5
5
  SHA512:
6
- metadata.gz: 8411d2a2141e28d778b47907d2594370c1f8c585d835e852a2f8c1ba46fba11ff9dab3abd7f3b5df269aa4149a7af4ca8055798d14ddf01cb484173695d78b1d
7
- data.tar.gz: 8fefa012326df5192ede21c356e081b696603fef3a1979143f18c3807bf567b4660f8f98ca2fee964f005a6c9d9dbdf5068b1a1e64b8b63f421a9e4555b96084
6
+ metadata.gz: 5565d62ec1ea44e874757af506cdeedf81d129cc8638442ede6171994f6d6bdc999131080d75f10c7a41cbf5d23914d3917e2dc88f826d13cfb0f60fc1ff5321
7
+ data.tar.gz: 84a0577201c562fd5112db9a04085d3eca695718b5738ca3b0d635c1a9f77a73aff7658b8fdcb3e0a38120f377859cc9fcc252370198714b06220b1a0ef2ba66
data/app/models/user.rb CHANGED
@@ -1,6 +1,3 @@
1
1
  class User < ApplicationRecord
2
- # Include default devise modules. Others available are:
3
- # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
4
- devise :database_authenticatable, :registerable,
5
- :recoverable, :rememberable, :validatable
2
+ devise :database_authenticatable, :rememberable, :validatable
6
3
  end
@@ -6,7 +6,7 @@ Rails.application.configure do
6
6
 
7
7
  Ability.send(:include, ThecoreAuthCommonsCanCanCanConcern)
8
8
  User.send(:include, ThecoreAuthCommonsUserConcern)
9
- User.devise_modules.delete(:recoverable) if ThecoreSettings::Setting.where(ns: :devise, key: :recoverable).first.present? && ThecoreSettings::Setting.where(ns: :devise, key: :recoverable).first.raw == "disable"
10
- User.devise_modules.delete(:registerable) if ThecoreSettings::Setting.where(ns: :devise, key: :registerable).first.present? && ThecoreSettings::Setting.where(ns: :devise, key: :registerable).first.raw == "disable"
9
+ # User.devise_modules.delete(:recoverable) if ThecoreSettings::Setting.where(ns: :devise, key: :recoverable).first.present? && ThecoreSettings::Setting.where(ns: :devise, key: :recoverable).first.raw == "disable"
10
+ # User.devise_modules.delete(:registerable) if ThecoreSettings::Setting.where(ns: :devise, key: :registerable).first.present? && ThecoreSettings::Setting.where(ns: :devise, key: :registerable).first.raw == "disable"
11
11
  end
12
12
  end
@@ -2,14 +2,14 @@
2
2
 
3
3
  class DeviseCreateUsers < ActiveRecord::Migration[7.0]
4
4
  def change
5
- create_table :users do |t|
5
+ create_table :users, if_not_exists: true do |t|
6
6
  ## Database authenticatable
7
7
  t.string :email, null: false, default: ""
8
8
  t.string :encrypted_password, null: false, default: ""
9
9
 
10
10
  ## Recoverable
11
- t.string :reset_password_token
12
- t.datetime :reset_password_sent_at
11
+ # t.string :reset_password_token
12
+ # t.datetime :reset_password_sent_at
13
13
 
14
14
  ## Rememberable
15
15
  t.datetime :remember_created_at
@@ -36,8 +36,8 @@ class DeviseCreateUsers < ActiveRecord::Migration[7.0]
36
36
  t.timestamps null: false
37
37
  end
38
38
 
39
- add_index :users, :email, unique: true
40
- add_index :users, :reset_password_token, unique: true
39
+ add_index :users, :email, unique: true, if_not_exists: true
40
+ # add_index :users, :reset_password_token, unique: true, if_not_exists: true
41
41
  # add_index :users, :confirmation_token, unique: true
42
42
  # add_index :users, :unlock_token, unique: true
43
43
  end
@@ -1,9 +1,9 @@
1
1
  class AddTrackableToUser < ActiveRecord::Migration[7.0]
2
2
  def change
3
- add_column :users, :sign_in_count, :bigint, default: 0, null: false
4
- add_column :users, :current_sign_in_at, :datetime
5
- add_column :users, :last_sign_in_at, :datetime
6
- add_column :users, :current_sign_in_ip, :string
7
- add_column :users, :last_sign_in_ip, :string
3
+ add_column :users, :sign_in_count, :bigint, default: 0, null: false, if_not_exists: true
4
+ add_column :users, :current_sign_in_at, :datetime, if_not_exists: true
5
+ add_column :users, :last_sign_in_at, :datetime, if_not_exists: true
6
+ add_column :users, :current_sign_in_ip, :string, if_not_exists: true
7
+ add_column :users, :last_sign_in_ip, :string, if_not_exists: true
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
1
  class AddAdminToUser < ActiveRecord::Migration[7.0]
2
2
  def change
3
- add_column :users, :admin, :boolean, null: false, default: false
3
+ add_column :users, :admin, :boolean, null: false, default: false, if_not_exists: true
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  class AddLockVersionToUser < ActiveRecord::Migration[7.0]
2
2
  def change
3
- add_column :users, :lock_version, :bigint
3
+ add_column :users, :lock_version, :bigint, if_not_exists: true
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  class AddLockedToUser < ActiveRecord::Migration[7.0]
2
2
  def change
3
- add_column :users, :locked, :boolean, null: false, default: false
3
+ add_column :users, :locked, :boolean, null: false, default: false, if_not_exists: true
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  class AddAccessTokenToUser < ActiveRecord::Migration[7.0]
2
2
  def change
3
- add_column :users, :encrypted_access_token, :string
3
+ add_column :users, :encrypted_access_token, :string, if_not_exists: true
4
4
  end
5
5
  end
@@ -1,11 +1,11 @@
1
1
  class CreateRoles < ActiveRecord::Migration[7.0]
2
2
  def change
3
- create_table :roles do |t|
3
+ create_table :roles, if_not_exists: true do |t|
4
4
  t.string :name
5
5
  t.bigint :lock_version
6
6
 
7
7
  t.timestamps
8
8
  end
9
- add_index :roles, :name, unique: true
9
+ add_index :roles, :name, unique: true, if_not_exists: true
10
10
  end
11
11
  end
@@ -1,6 +1,6 @@
1
1
  class CreateRoleUsers < ActiveRecord::Migration[7.0]
2
2
  def change
3
- create_table :role_users do |t|
3
+ create_table :role_users, if_not_exists: true do |t|
4
4
  t.references :role, null: false, foreign_key: true
5
5
  t.references :user, null: false, foreign_key: true
6
6
 
@@ -1,33 +1,33 @@
1
- class CreatePermissionsChain < ActiveRecord::Migration[6.0]
1
+ class CreatePermissionsChain < ActiveRecord::Migration[7.0]
2
2
  def change
3
3
  # Predicates
4
- create_table :predicates do |t|
4
+ create_table :predicates, if_not_exists: true do |t|
5
5
  t.string :name
6
6
  t.bigint :lock_version
7
7
 
8
8
  t.timestamps
9
9
  end
10
- add_index :predicates, :name, unique: true
10
+ add_index :predicates, :name, unique: true, if_not_exists: true
11
11
 
12
12
  # Actions
13
- create_table :actions do |t|
13
+ create_table :actions, if_not_exists: true do |t|
14
14
  t.string :name
15
15
  t.bigint :lock_version
16
16
 
17
17
  t.timestamps
18
18
  end
19
- add_index :actions, :name, unique: true
19
+ add_index :actions, :name, unique: true, if_not_exists: true
20
20
 
21
21
  # Targets
22
- create_table :targets do |t|
22
+ create_table :targets, if_not_exists: true do |t|
23
23
  t.string :name
24
24
  t.bigint :lock_version
25
25
 
26
26
  t.timestamps
27
27
  end
28
- add_index :targets, :name, unique: true
28
+ add_index :targets, :name, unique: true, if_not_exists: true
29
29
 
30
- create_table :permissions do |t|
30
+ create_table :permissions, if_not_exists: true do |t|
31
31
  t.references :predicate, null: false, foreign_key: true
32
32
  t.references :action, null: false, foreign_key: true
33
33
  t.references :target, null: false, foreign_key: true
@@ -36,7 +36,7 @@ class CreatePermissionsChain < ActiveRecord::Migration[6.0]
36
36
  t.timestamps
37
37
  end
38
38
  # Association table
39
- create_table :permission_roles do |t|
39
+ create_table :permission_roles, if_not_exists: true do |t|
40
40
  t.references :role, null: false, foreign_key: true
41
41
  t.references :permission, null: false, foreign_key: true
42
42
  t.bigint :lock_version
data/db/seeds.rb CHANGED
@@ -26,6 +26,3 @@ end
26
26
  fill :predicates
27
27
  fill :actions
28
28
  fill :targets
29
-
30
- ThecoreSettings::Setting.create(ns: :devise, key: :registerable, raw: "disable")
31
- ThecoreSettings::Setting.create(ns: :devise, key: :recoverable, raw: "disable")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_auth_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni