app/models/anoubis/tenant/user.rb
##
# Validates users element. Sets default missing parameters. Prevents changing tenant for existing user.
# @param is_new [Boolean] sets into true when user is being created
Validates users element. Sets default missing parameters. Prevents changing tenant for existing user.
Validates users element . Sets default missing parameters . Prevents changing tenant for existing user .
def validate_anubis_user(is_new)
    self.locale = 'ru-RU' if !self.locale
    self.timeout = 3600 if !self.timeout
    self.tenant_id = self.tenant_id_was if !is_new 
    self.status = 0 if self.id == 1 
    if !password.blank?
      if password != password_confirmation
        errors.add(:password, I18n.t('users.errors.different_passwords'))
        errors.add(:password_confirmation, I18n.t('users.errors.different_passwords'))
        return false
      end
    end
    return true
  end
def validate_anubis_user ( is_new ) self . locale = 'ru-RU' if ! self . locale self . timeout = 3600 if ! self . timeout self . tenant_id = self . tenant_id_was if ! is_new self . status = 0 if self . id == 1 if ! password . blank? if password != password_confirmation errors . add ( :password , I18n . t ( 'users.errors.different_passwords' ) ) errors . add ( :password_confirmation , I18n . t ( 'users.errors.different_passwords' ) ) return false end end return true end
Validates users element.
Validates users element .
# Can't change tenant for existing user # Can't disable Main Administrator
is_new
sets into true when user is being created
sets into true when user is being created