* Move isLimitedInExecution function from control to zen.

This commit is contained in:
mayue
2023-05-10 11:14:39 +00:00
parent e2a66e7283
commit 0a2b90f779
2 changed files with 18 additions and 18 deletions
+1 -18
View File
@@ -115,7 +115,7 @@ class task extends control
parse_str($extra, $output);
/* 判断不能访问的执行。 TODO: 提示语应改为执行。 */
if($this->checkLimitedExecution($executionID))
if($this->taskZen->isLimitedInExecution($executionID))
{
echo js::alert($this->lang->task->createDenied);
return print(js::locate($this->createLink('execution', 'task', "executionID=$executionID")));
@@ -1912,21 +1912,4 @@ class task extends control
$this->view->users = $this->loadModel('user')->getPairs();
$this->display('', 'editteam');
}
/**
* 检查当前用户在该执行中是否是受限用户。
* Checks if the current user is a limited user in this execution.
*
* @param string $executionID
* @access public
* @return bool
*/
public function checkLimitedExecution(string $executionID): bool
{
$this->execution->getLimitedExecution();
$limitedExecutions = !empty($_SESSION['limitedExecutions']) ? $_SESSION['limitedExecutions'] : '';
if(strpos(",{$limitedExecutions},", ",$executionID,") !== false) return true;
return false;
}
}
+17
View File
@@ -576,6 +576,23 @@ class taskZen extends task
return $task;
}
/**
* 检查当前用户在该执行中是否是受限用户。
* Checks if the current user is a limited user in this execution.
*
* @param string $executionID
* @access public
* @return bool
*/
public function isLimitedInExecution(string $executionID): bool
{
$this->execution->getLimitedExecution();
$limitedExecutions = !empty($this->session->limitedExecutions) ? $this->session->limitedExecutions : '';
if(strpos(",{$limitedExecutions},", ",$executionID,") !== false) return true;
return false;
}
/**
* 检查传入的创建数据是否符合要求。
* Check if the input post meets the requirements.