From 66f9f13508149fe05cb402114633c3d800dc7217 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Fri, 18 Nov 2022 11:47:27 +0100 Subject: [PATCH] Implement current team switch when navigating to tasks and experiments from another team [SCI-7447] --- app/controllers/experiments_controller.rb | 1 + app/controllers/my_modules_controller.rb | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/app/controllers/experiments_controller.rb b/app/controllers/experiments_controller.rb index d2f485a97..07cd60704 100644 --- a/app/controllers/experiments_controller.rb +++ b/app/controllers/experiments_controller.rb @@ -342,6 +342,7 @@ class ExperimentsController < ApplicationController end def check_read_permissions + current_team_switch(@experiment.project.team) if current_team != @experiment.project.team render_403 unless can_read_experiment?(@experiment) || @experiment.archived? && can_read_archived_experiment?(@experiment) end diff --git a/app/controllers/my_modules_controller.rb b/app/controllers/my_modules_controller.rb index 5d36ec9bc..cce723427 100644 --- a/app/controllers/my_modules_controller.rb +++ b/app/controllers/my_modules_controller.rb @@ -268,7 +268,6 @@ class MyModulesController < ApplicationController def protocols @protocol = @my_module.protocol @assigned_repositories = @my_module.live_and_snapshot_repositories_list - current_team_switch(@protocol.team) end def protocol @@ -291,11 +290,6 @@ class MyModulesController < ApplicationController end def results - current_team_switch(@my_module - .experiment - .project - .team) - @results_order = params[:order] || 'new' @results = @my_module.archived_branch? ? @my_module.results : @my_module.results.active @@ -311,7 +305,6 @@ class MyModulesController < ApplicationController def archive @archived_results = @my_module.archived_results - current_team_switch(@my_module.experiment.project.team) end def restore_group @@ -383,6 +376,7 @@ class MyModulesController < ApplicationController end def check_read_permissions + current_team_switch(@project.team) if current_team != @project.team render_403 unless can_read_my_module?(@my_module) end