Преглед на файлове

fixed error msg for edit record without perms

Piotr Labudda преди 8 години
родител
ревизия
c9863544d8
променени са 1 файла, в които са добавени 10 реда и са изтрити 1 реда
  1. 10 1
      SE/se-lib/Route/ViewTableAjax.php

+ 10 - 1
SE/se-lib/Route/ViewTableAjax.php

@@ -418,7 +418,16 @@ class Route_ViewTableAjax extends RouteBase {
 		$tbl = $this->getTableAjaxWidget($acl);
 		$tbl = $this->getTableAjaxWidget($acl);
 
 
 		$record = $acl->buildQuery([])->getItem($id);
 		$record = $acl->buildQuery([])->getItem($id);
-		if (!$acl->canWriteRecord($record) && !$acl->hasPermSuperWrite()) throw new Exception("Brak dostępu do rekordu");
+		if (!$acl->canWriteRecord($record) && !$acl->hasPermSuperWrite()) {
+			return [
+				'type' => "success",
+				'msg' => "Edycja rekordu nr {$id}",
+				'body' => [
+					'reactNode' => [ 'div', [ 'class' => "alert alert-danger" ], "Brak dostępu do rekordu" ]
+				],
+			];
+			// throw new Exception("Brak dostępu do rekordu");
+		}
 		$fieldsList = array();
 		$fieldsList = array();
 		foreach ($acl->getFieldListByIdZasob() as $kID => $fieldName) {
 		foreach ($acl->getFieldListByIdZasob() as $kID => $fieldName) {
 			if ($fieldName == 'ID') continue;
 			if ($fieldName == 'ID') continue;