Use attribute for User#bypass_registration_checks? (#35580)
This commit is contained in:
@@ -132,9 +132,10 @@ class User < ApplicationRecord
|
|||||||
delegate :can?, to: :role
|
delegate :can?, to: :role
|
||||||
|
|
||||||
attr_reader :invite_code, :date_of_birth
|
attr_reader :invite_code, :date_of_birth
|
||||||
attr_writer :bypass_registration_checks, :current_account
|
attr_writer :current_account
|
||||||
|
|
||||||
attribute :external, :boolean, default: false
|
attribute :external, :boolean, default: false
|
||||||
|
attribute :bypass_registration_checks, :boolean, default: false
|
||||||
|
|
||||||
def self.those_who_can(*any_of_privileges)
|
def self.those_who_can(*any_of_privileges)
|
||||||
matching_role_ids = UserRole.that_can(*any_of_privileges).map(&:id)
|
matching_role_ids = UserRole.that_can(*any_of_privileges).map(&:id)
|
||||||
@@ -477,10 +478,6 @@ class User < ApplicationRecord
|
|||||||
Setting.registrations_mode == 'open'
|
Setting.registrations_mode == 'open'
|
||||||
end
|
end
|
||||||
|
|
||||||
def bypass_registration_checks?
|
|
||||||
@bypass_registration_checks
|
|
||||||
end
|
|
||||||
|
|
||||||
def sanitize_role
|
def sanitize_role
|
||||||
self.role = nil if role.present? && role.everyone?
|
self.role = nil if role.present? && role.everyone?
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user