From a153e926f899a066408c19068d24bfc8cf74cb1d Mon Sep 17 00:00:00 2001 From: Wabo Date: Mon, 1 Jun 2026 14:09:32 -0400 Subject: [PATCH] Restore EDITOR_ROLE, VIEWER_ROLE, and editor?, viewer? methods to User model (fork-specific, removed during upstream sync) --- app/models/user.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index b80ae769..1975b4cb 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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