feat: remove saml methods from user

This commit is contained in:
Shivam Mishra
2025-08-28 15:57:35 +05:30
parent 3fb2506aab
commit 2b533aa135
4 changed files with 2 additions and 29 deletions
-14
View File
@@ -152,20 +152,6 @@ class User < ApplicationRecord
mutations_from_database.changed?('email')
end
# SAML methods - fallback implementations for Community Edition
# These will be overridden in Enterprise Edition via include_mod_with
def saml_user?
false
end
def convert_to_saml!
# No-op in Community Edition
end
def password_authentication_allowed?
true
end
def self.from_email(email)
find_by(email: email&.downcase)
end
@@ -12,7 +12,7 @@ module Enterprise::DeviseOverrides::PasswordsController
return if params[:email].blank?
user = User.from_email(params[:email])
return unless user&.saml_user?
return unless user&.provider == 'saml'
raise CustomExceptions::Base.new(I18n.t('messages.reset_password_saml_user'), :forbidden)
end
@@ -41,7 +41,7 @@ module Enterprise::DeviseOverrides::SessionsController
return if params[:email].blank?
user = User.from_email(params[:email])
return unless user&.saml_user?
return unless user&.provider == 'saml'
raise CustomExceptions::Base.new(I18n.t('messages.login_saml_user'), :unauthorized)
end
@@ -13,17 +13,4 @@ module Enterprise::Concerns::User
errors.add(:base, 'User limit reached. Please purchase more licenses from super admin') if User.count >= ChatwootHub.pricing_plan_quantity
end
# SAML authentication methods (Enterprise only)
def saml_user?
provider == 'saml'
end
def convert_to_saml!
update!(provider: 'saml')
end
def password_authentication_allowed?
!saml_user?
end
end