feat: move saml methods to enterprise

This commit is contained in:
Shivam Mishra
2025-08-28 15:03:23 +05:30
parent 5419b949a4
commit 5fb0c80891
2 changed files with 18 additions and 4 deletions
+5 -4
View File
@@ -152,17 +152,18 @@ class User < ApplicationRecord
mutations_from_database.changed?('email')
end
# SAML authentication methods
# SAML methods - fallback implementations for Community Edition
# These will be overridden in Enterprise Edition via include_mod_with
def saml_user?
provider == 'saml'
false
end
def convert_to_saml!
update!(provider: 'saml')
# No-op in Community Edition
end
def password_authentication_allowed?
!saml_user?
true
end
def self.from_email(email)
@@ -13,4 +13,17 @@ 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