Jelajahi Sumber

added catch acl access errors in Typespecial query

Piotr Labudda 9 tahun lalu
induk
melakukan
431dbe752a
1 mengubah file dengan 15 tambahan dan 10 penghapusan
  1. 15 10
      SE/se-lib/Typespecial.php

+ 15 - 10
SE/se-lib/Typespecial.php

@@ -858,18 +858,23 @@ jQuery('#typeahead-{$fName}').typeahead({
 		DBG::log(['msg'=>"this", $this]);
 		Lib::loadClass('ACL');
 		Lib::loadClass('AclQueryFeatures');
-		$andSql = array_map(
-			function ($tableName, $idTable) {
-				$tableAcl = User::getAcl()->getObjectAcl('default_db', $tableName);
-				return ACL::query($tableAcl, "t_{$idTable}")
+		try {
+			$andSql = array_map(
+				function ($tableName, $idTable) {
+					$tableAcl = User::getAcl()->getObjectAcl('default_db', $tableName);
+					return ACL::query($tableAcl, "t_{$idTable}")
 					->where( (new AclQueryFeatures($tableAcl, $params = []))->parseSpecialFilterAccess() )
 					->generateWhereSql()
-				;
-			},
-			$this->tblAliasList, array_keys($this->tblAliasList)
-		);
-		$andSql = array_filter($andSql, ['V', 'filterNotEmpty']);
-		if (!empty($andSql)) $sqlWhereAdd .= "\n" . " and " . implode(" and ", $andSql);
+					;
+				},
+				$this->tblAliasList, array_keys($this->tblAliasList)
+			);
+			$andSql = array_filter($andSql, ['V', 'filterNotEmpty']);
+			if (!empty($andSql)) $sqlWhereAdd .= "\n" . " and " . implode(" and ", $andSql);
+		} catch (Exception $e) {
+			DBG::log($e);
+			return [];
+		}
 		$sqlLimit = V::get('limit', 0, $this->sqlQuery, 'int');
 		$sqlLimit = ($sqlLimit > 0) ? $sqlLimit : 20;