mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 10:45:58 +02:00
Admin can change other users settings without user password #2646
This commit is contained in:
parent
13b60d39ce
commit
4da89aaa87
9 changed files with 67 additions and 81 deletions
|
@ -1,9 +1,10 @@
|
|||
class AdminUser < User
|
||||
validates :username, :password, :country_code, :roles, presence: true
|
||||
validates :username, :country_code, :roles, presence: true
|
||||
validates :identity_code, uniqueness: true, allow_blank: true
|
||||
validates :identity_code, presence: true, if: -> { country_code == 'EE' }
|
||||
validates :email, presence: true
|
||||
|
||||
validates :password, :password_confirmation, presence: true, if: :new_record?
|
||||
validates :password_confirmation, presence: true, if: :encrypted_password_changed?
|
||||
validate :validate_identity_code, if: -> { country_code == 'EE' }
|
||||
|
||||
ROLES = %w(user customer_service admin) # should not match to api_users roles
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue