Restore EDITOR_ROLE, VIEWER_ROLE, and editor?, viewer? methods to User model (fork-specific, removed during upstream sync)

pull/687/head
Wabo 3 weeks ago
parent ae16a0a0bf
commit a153e926f8

@ -48,7 +48,9 @@
#
class User < ApplicationRecord
ROLES = [
ADMIN_ROLE = 'admin'
ADMIN_ROLE = 'admin',
EDITOR_ROLE = 'editor',
VIEWER_ROLE = 'viewer'
].freeze
EMAIL_REGEXP = /[^@;,<>\s]+@[^@;,<>\s]+/
@ -98,6 +100,10 @@ class User < ApplicationRecord
role == 'admin'
end
def admin? = role == ADMIN_ROLE
def editor? = role == EDITOR_ROLE
def viewer? = role == VIEWER_ROLE
def self.sign_in_after_reset_password
if PasswordsController::Current.user.present?
!PasswordsController::Current.user.otp_required_for_login

Loading…
Cancel
Save