* [apiv2] Fix bug#66974.

This commit is contained in:
朱金勇
2026-01-04 11:39:44 +08:00
parent 00cdf3d527
commit c30a24a8e4
+6 -1
View File
@@ -470,6 +470,8 @@ class api extends router
'userID' => TABLE_USER,
'ticket' => TABLE_TICKET,
'ticketID' => TABLE_TICKET,
'dept' => TABLE_DEPT,
'deptID' => TABLE_DEPT,
];
$params = array_merge($this->params, $_POST);
@@ -478,7 +480,10 @@ class api extends router
if(isset($objectMap[$key]) && $value)
{
$table = $objectMap[$key];
$object = $this->dao->select('*')->from($table)->where('id')->eq($value)->andWhere('deleted')->eq('0')->fetch();
$object = $this->dao->select('*')->from($table)
->where('id')->eq($value)
->beginIF(!in_array($key, ['dept', 'deptID']))->andWhere('deleted')->eq('0')->fi()
->fetch();
if(!$object) return $this->control->sendError(ucfirst(str_replace('ID', '', $key)) . ' does not exist.');
if(!$this->checkObjectPriv($object, $table)) return $this->control->sendError(ucfirst(str_replace('ID', '', $key)) . ' is not allowed.');