From 14a67c48df2ee68806758a829be496c0bea0dc23 Mon Sep 17 00:00:00 2001 From: liugang Date: Mon, 18 Sep 2023 15:49:09 +0800 Subject: [PATCH] * testtask: check if user have permission to access the product to which the testtask belongs. --- module/testtask/control.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/module/testtask/control.php b/module/testtask/control.php index 1ec4ac18a3..987e6d8f3d 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -406,12 +406,14 @@ class testtask extends control if($this->cookie->preTaskID != $taskID) helper::setcookie('taskCaseModule', 0, 0); if($browseType == 'bymodule') helper::setcookie('taskCaseModule', $param, 0); + /* 检查是否有权限访问测试单所属产品。*/ + /* Check if user have permission to access the product to which the testtask belongs. */ + $productID = $this->loadModel('product')->checkAccess($testtask->product, $this->products); + /* 如果测试单所属产品在产品键值对中不存在,将其加入。*/ /* Prepare the product key-value pairs. */ - $products = $this->products; - $productID = $testtask->product; - $product = $this->loadModel('product')->getByID($productID); - if(!isset($products[$productID])) $products[$productID] = $product->name; + $product = $this->loadModel('product')->getByID($productID); + if(!isset($this->products[$productID])) $this->products[$productID] = $product->name; $this->testtaskZen->setMenu($productID, $testtask->branch, $testtask->project, $testtask->execution);