chore: Validation for purchased pricing_plan_quantity (#8809)
- Add validations based on purchased pricing_plan_quantity - Modify the Dashboard to support the new error message
This commit is contained in:
13
enterprise/app/models/enterprise/concerns/user.rb
Normal file
13
enterprise/app/models/enterprise/concerns/user.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
module Enterprise::Concerns::User
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_validation :ensure_installation_pricing_plan_quantity
|
||||
end
|
||||
|
||||
def ensure_installation_pricing_plan_quantity
|
||||
return unless ChatwootHub.pricing_plan == 'premium'
|
||||
|
||||
errors.add(:base, 'User limit reached. Please purchase more licenses from super admin') if User.count >= ChatwootHub.pricing_plan_quantity
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user