From d611d9d71ad1cbaaa85f77bf0cde4c9864b46a4d Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 3 Dec 2024 09:04:19 +0800 Subject: [PATCH] + [task#133216,done,1h] process limited executions by project. --- module/execution/model.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/module/execution/model.php b/module/execution/model.php index 3da87bfc15..e1c023c1f8 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1816,6 +1816,27 @@ class executionModel extends model /* If is admin, return true. */ if($this->app->user->admin) return true; + /* Get all teams of all limited projects and group by projects. */ + $projects = $this->dao->select('root, limited')->from(TABLE_TEAM) + ->where('type')->eq('project') + ->andWhere('account')->eq($this->app->user->account) + ->andWhere('limited')->eq('yes') + ->orderBy('root asc') + ->fetchPairs('root', 'root'); + $subExecutions = $this->dao->select('id, id')->from(TABLE_EXECUTION)->where('project')->in($projects)->fetchPairs(); + + /* Get no limited executions in limited projects. */ + $notLimitedExecutions = $this->dao->select('root, limited')->from(TABLE_TEAM) + ->where('type')->eq('execution') + ->andWhere('account')->eq($this->app->user->account) + ->andWhere('limited')->eq('no') + ->andWhere('root')->in($subExecutions) + ->orderBy('root asc') + ->fetchPairs('root', 'root'); + + /* 获取当前用户再受限项目下的非受限执行以外的执行。 */ + $subExecutions = array_diff($subExecutions, $notLimitedExecutions); + /* Get all teams of all executions and group by executions, save it as static. */ $executions = $this->dao->select('root, limited')->from(TABLE_TEAM) ->where('type')->eq('execution') @@ -1824,6 +1845,8 @@ class executionModel extends model ->orderBy('root asc') ->fetchPairs('root', 'root'); + $executions = array_merge($executions, $subExecutions); + $this->session->set('limitedExecutions', implode(',', $executions)); return $this->session->limitedExecutions; }