Browse Source

Allow users to be marked as inactive

pull/564/head
baarkerlounger 3 years ago
parent
commit
afea601d84
  1. 5
      db/migrate/20220510134721_add_inactive_users.rb
  2. 3
      db/schema.rb
  3. 4
      spec/models/user_spec.rb

5
db/migrate/20220510134721_add_inactive_users.rb

@ -0,0 +1,5 @@
class AddInactiveUsers < ActiveRecord::Migration[7.0]
def change
add_column :users, :active, :boolean, default: true
end
end

3
db/schema.rb

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2022_05_10_091620) do ActiveRecord::Schema[7.0].define(version: 2022_05_10_134721) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -339,6 +339,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_05_10_091620) do
t.string "direct_otp" t.string "direct_otp"
t.datetime "direct_otp_sent_at", precision: nil t.datetime "direct_otp_sent_at", precision: nil
t.datetime "totp_timestamp", precision: nil t.datetime "totp_timestamp", precision: nil
t.boolean "active", default: true
t.index ["email"], name: "index_users_on_email", unique: true t.index ["email"], name: "index_users_on_email", unique: true
t.index ["encrypted_otp_secret_key"], name: "index_users_on_encrypted_otp_secret_key", unique: true t.index ["encrypted_otp_secret_key"], name: "index_users_on_encrypted_otp_secret_key", unique: true
t.index ["organisation_id"], name: "index_users_on_organisation_id" t.index ["organisation_id"], name: "index_users_on_organisation_id"

4
spec/models/user_spec.rb

@ -65,6 +65,10 @@ RSpec.describe User, type: :model do
.to change { user.reload.is_data_protection_officer? }.from(false).to(true) .to change { user.reload.is_data_protection_officer? }.from(false).to(true)
end end
it "is active by default" do
expect(user.active).to be true
end
it "does not require 2FA" do it "does not require 2FA" do
expect(user.need_two_factor_authentication?(nil)).to be false expect(user.need_two_factor_authentication?(nil)).to be false
end end

Loading…
Cancel
Save