From e8b66a0525f0468fe6588803ec2a15ff186d08ab Mon Sep 17 00:00:00 2001 From: Emelia Smith Date: Tue, 13 Feb 2024 18:14:49 +0100 Subject: [PATCH] Ignore legacy moderator and admin columns on User model (#29188) --- app/models/concerns/user/ldap_authenticable.rb | 10 +++++++++- app/models/concerns/user/pam_authenticable.rb | 1 - app/models/user.rb | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/user/ldap_authenticable.rb b/app/models/concerns/user/ldap_authenticable.rb index d84ff084b2..180df9d310 100644 --- a/app/models/concerns/user/ldap_authenticable.rb +++ b/app/models/concerns/user/ldap_authenticable.rb @@ -25,7 +25,15 @@ module User::LdapAuthenticable resource = joins(:account).find_by(accounts: { username: safe_username }) if resource.blank? - resource = new(email: attributes[Devise.ldap_mail.to_sym].first, agreement: true, account_attributes: { username: safe_username }, admin: false, external: true, confirmed_at: Time.now.utc) + resource = new( + email: attributes[Devise.ldap_mail.to_sym].first, + agreement: true, + account_attributes: { + username: safe_username, + }, + external: true, + confirmed_at: Time.now.utc + ) resource.save! end diff --git a/app/models/concerns/user/pam_authenticable.rb b/app/models/concerns/user/pam_authenticable.rb index a682058cca..30dc7d8aef 100644 --- a/app/models/concerns/user/pam_authenticable.rb +++ b/app/models/concerns/user/pam_authenticable.rb @@ -32,7 +32,6 @@ module User::PamAuthenticable self.email = "#{account.username}@#{find_pam_suffix}" if email.nil? && find_pam_suffix self.confirmed_at = Time.now.utc - self.admin = false self.account = account self.external = true diff --git a/app/models/user.rb b/app/models/user.rb index 70c24336f3..95fdc431ac 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -51,6 +51,8 @@ class User < ApplicationRecord last_sign_in_ip skip_sign_in_token filtered_languages + admin + moderator ) include LanguagesHelper