feat: remove enforced_sso and attribute_mappings field

This commit is contained in:
Shivam Mishra
2025-08-28 16:27:44 +05:30
parent 846ea71e56
commit 0c9e4f430a
6 changed files with 17 additions and 31 deletions
@@ -5,8 +5,6 @@ class CreateAccountSamlSettings < ActiveRecord::Migration[7.1]
t.string :sso_url
t.text :certificate
t.string :sp_entity_id
t.boolean :enforced_sso, default: false, null: false
t.json :attribute_mappings, default: {}
t.json :role_mappings, default: {}
t.timestamps
-2
View File
@@ -33,8 +33,6 @@ ActiveRecord::Schema[7.1].define(version: 2025_08_25_070005) do
t.string "sso_url"
t.text "certificate"
t.string "sp_entity_id"
t.boolean "enforced_sso", default: false, null: false
t.json "attribute_mappings", default: {}
t.json "role_mappings", default: {}
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
@@ -31,8 +31,6 @@ class Api::V1::Accounts::SamlSettingsController < Api::V1::Accounts::BaseControl
:sso_url,
:certificate,
:sp_entity_id,
:enforced_sso,
attribute_mappings: {},
role_mappings: {}
)
end
+16 -10
View File
@@ -2,16 +2,14 @@
#
# Table name: account_saml_settings
#
# id :bigint not null, primary key
# attribute_mappings :json
# certificate :text
# enforced_sso :boolean default(FALSE), not null
# role_mappings :json
# sso_url :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :bigint not null
# sp_entity_id :string
# id :bigint not null, primary key
# certificate :text
# role_mappings :json
# sso_url :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :bigint not null
# sp_entity_id :string
#
# Indexes
#
@@ -33,6 +31,14 @@ class AccountSamlSettings < ApplicationRecord
sp_entity_id.presence || "#{installation_name}-#{account_id}".downcase
end
def attribute_mappings
{
'email' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress',
'first_name' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname',
'last_name' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname'
}
end
private
def installation_name
@@ -2,8 +2,6 @@ json.id account_saml_settings.id
json.account_id account_saml_settings.account_id
json.sso_url account_saml_settings.sso_url
json.sp_entity_id account_saml_settings.sp_entity_id
json.enforced_sso account_saml_settings.enforced_sso
json.attribute_mappings account_saml_settings.attribute_mappings || {}
json.role_mappings account_saml_settings.role_mappings || {}
json.created_at account_saml_settings.created_at
json.updated_at account_saml_settings.updated_at
json.updated_at account_saml_settings.updated_at
-12
View File
@@ -16,8 +16,6 @@ FactoryBot.define do
cert.to_pem
end
sp_entity_id { 'chatwoot-test' }
enforced_sso { false }
attribute_mappings { {} }
role_mappings { {} }
trait :with_role_mappings do
@@ -29,15 +27,5 @@ FactoryBot.define do
}
end
end
trait :with_attribute_mappings do
attribute_mappings do
{
'email' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress',
'name' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name',
'first_name' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname'
}
end
end
end
end