diff --git a/app/components/users/hover_card_component.rb b/app/components/users/hover_card_component.rb index 52da4ee0ced..7b04ba87313 100644 --- a/app/components/users/hover_card_component.rb +++ b/app/components/users/hover_card_component.rb @@ -34,7 +34,7 @@ class Users::HoverCardComponent < ApplicationComponent def initialize(id:) super - @user = User.find_by(id:) + @user = User.visible.find_by(id:) end def render? diff --git a/app/controllers/placeholder_users/memberships_controller.rb b/app/controllers/placeholder_users/memberships_controller.rb index a979f2bce23..1ebce719388 100644 --- a/app/controllers/placeholder_users/memberships_controller.rb +++ b/app/controllers/placeholder_users/memberships_controller.rb @@ -30,13 +30,14 @@ class PlaceholderUsers::MembershipsController < ApplicationController include IndividualPrincipals::MembershipControllerMethods + layout "admin" before_action :authorize_global before_action :find_individual_principal def find_individual_principal - @individual_principal = PlaceholderUser.find(params[:placeholder_user_id]) + @individual_principal = PlaceholderUser.visible.find(params[:placeholder_user_id]) end def redirected_to_tab(_membership) diff --git a/app/controllers/placeholder_users_controller.rb b/app/controllers/placeholder_users_controller.rb index 77ba46d8b12..1b2caefff71 100644 --- a/app/controllers/placeholder_users_controller.rb +++ b/app/controllers/placeholder_users_controller.rb @@ -111,7 +111,7 @@ class PlaceholderUsersController < ApplicationController respond_to do |format| format.html do flash[:notice] = I18n.t(:notice_successful_update) - redirect_back(fallback_location: edit_placeholder_user_path(@placeholder_user)) + redirect_back_or_to(edit_placeholder_user_path(@placeholder_user)) end end else @@ -146,7 +146,7 @@ class PlaceholderUsersController < ApplicationController private def find_placeholder_user - @placeholder_user = PlaceholderUser.find(params[:id]) + @placeholder_user = PlaceholderUser.visible.find(params[:id]) end protected diff --git a/app/controllers/shares_controller.rb b/app/controllers/shares_controller.rb index 850dd72b3f8..51997db62b9 100644 --- a/app/controllers/shares_controller.rb +++ b/app/controllers/shares_controller.rb @@ -57,7 +57,7 @@ class SharesController < ApplicationController visible_shares_before_adding = sharing_strategy.shares.present? find_or_create_users(send_notification: send_notification?) do |member_params| - user = User.find_by(id: member_params[:user_id]) + user = User.visible.find_by(id: member_params[:user_id]) if user.present? && (user.locked? || user.deleted?) @errors.add(:base, I18n.t("sharing.warning_locked_user", user: user.name)) else diff --git a/app/controllers/users/memberships_controller.rb b/app/controllers/users/memberships_controller.rb index 5e012762f29..044717f84ed 100644 --- a/app/controllers/users/memberships_controller.rb +++ b/app/controllers/users/memberships_controller.rb @@ -30,13 +30,14 @@ class Users::MembershipsController < ApplicationController include IndividualPrincipals::MembershipControllerMethods + layout "admin" before_action :authorize_global before_action :find_individual_principal def find_individual_principal - @individual_principal = User.find(params[:user_id]) + @individual_principal = User.visible.find(params[:user_id]) end def redirected_to_tab(membership) diff --git a/app/services/projects/creation_wizard/create_artifact_work_package_service.rb b/app/services/projects/creation_wizard/create_artifact_work_package_service.rb index 2eec2841c0f..a065a9e98bc 100644 --- a/app/services/projects/creation_wizard/create_artifact_work_package_service.rb +++ b/app/services/projects/creation_wizard/create_artifact_work_package_service.rb @@ -182,7 +182,7 @@ module Projects::CreationWizard end def assignee_mention_tag - principal = Principal.find(assigned_to_id) + principal = Principal.visible.find(assigned_to_id) ApplicationController.helpers.content_tag( "mention", diff --git a/app/views/oauth/applications/_form.html.erb b/app/views/oauth/applications/_form.html.erb index e8ed22fc5fb..7d129855d93 100644 --- a/app/views/oauth/applications/_form.html.erb +++ b/app/views/oauth/applications/_form.html.erb @@ -110,7 +110,7 @@ See COPYRIGHT and LICENSE files for more details.
<% if @application.client_credentials_user_id %>- <% user = User.find(@application.client_credentials_user_id) %> + <% user = User.visible.find(@application.client_credentials_user_id) %> <%= t("oauth.client_credentials_impersonation_set_to") %> <%= link_to_user user %>
diff --git a/app/views/oauth/applications/show.html.erb b/app/views/oauth/applications/show.html.erb index abf63bb0592..cbb765714aa 100644 --- a/app/views/oauth/applications/show.html.erb +++ b/app/views/oauth/applications/show.html.erb @@ -54,7 +54,7 @@ See COPYRIGHT and LICENSE files for more details. <% component.with_attribute( key: t("oauth.client_credentials_impersonation_set_to") ) do %> - <%= link_to_user User.find_by(id: user_id) %> + <%= link_to_user User.visible.find_by(id: user_id) %>