|
|
@@ -24,10 +24,32 @@ class Route_Storage_AclUsage extends RouteBase {
|
|
|
if (!$typeName) throw new Exception("Wrong param typeName");
|
|
|
$namespace = Api_WfsNs::getBaseWfsUri() . '/' . str_replace(':', '/', $typeName);
|
|
|
}
|
|
|
- $acl = Core_AclHelper::getAclByNamespace($namespace, $forceTblAclInit = ('1' == V::get('_force', '', $_GET)));
|
|
|
-
|
|
|
- $rootTableName = $acl->getRootTableName();
|
|
|
- $idTable = $acl->getID();
|
|
|
+ $aclNamespace = null;
|
|
|
+ $rootTableName = null;
|
|
|
+ $idTable = null;
|
|
|
+ $idDatabase = null;
|
|
|
+ try {
|
|
|
+ $acl = Core_AclHelper::getAclByNamespace($namespace, $forceTblAclInit = ('1' == V::get('_force', '', $_GET)));
|
|
|
+ $rootTableName = $acl->getRootTableName();
|
|
|
+ $idTable = $acl->getID();
|
|
|
+ $aclNamespace = $acl->getNamespace();
|
|
|
+ $idDatabase = $acl->getDatabaseID();
|
|
|
+ } catch (Exception $e) {
|
|
|
+ DBG::log($e);
|
|
|
+ }
|
|
|
+ if (!$aclNamespace) {
|
|
|
+ try {
|
|
|
+ $item = SchemaFactory::loadDefaultObject('SystemObject')->getItem($namespace, [ 'propertyName' => '*,field' ]);
|
|
|
+ $rootTableName = $item['_rootTableName'];
|
|
|
+ $idTable = $item['idZasob'];
|
|
|
+ $aclNamespace = $item['namespace'];
|
|
|
+ } catch (Exception $e) {
|
|
|
+ DBG::log($e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!$aclNamespace) throw new Exception("Object not found '{$namespace}'");
|
|
|
+ if (!$rootTableName) throw new Exception("Missing rootTableName");
|
|
|
+ if (!$idTable) throw new Exception("Missing idTable");
|
|
|
|
|
|
$renderProcesLink = function ($idProces) {
|
|
|
return UI::h('a', [
|
|
|
@@ -37,8 +59,8 @@ class Route_Storage_AclUsage extends RouteBase {
|
|
|
};
|
|
|
$renderPermCell = function ($value) {
|
|
|
return ($value)
|
|
|
- ? UI::h('span', [ 'class' => "label label-success" ], $value)
|
|
|
- : UI::h('span', [ 'class' => "label label-danger" ], $value);
|
|
|
+ ? UI::h('span', [ 'class' => "label label-success" ], (string)$value)
|
|
|
+ : UI::h('span', [ 'class' => "label label-danger" ], (string)$value);
|
|
|
};
|
|
|
$permCols = [ 'PERM_R', 'PERM_W', 'PERM_X', 'PERM_C', 'PERM_S', 'PERM_O', 'PERM_V', 'PERM_E' ];
|
|
|
$labelPermCols = [ 'PERM_R' => 'R', 'PERM_W' => 'W', 'PERM_X' => 'X', 'PERM_C' => 'C', 'PERM_S' => 'S', 'PERM_O' => 'O', 'PERM_V' => 'V', 'PERM_E' => 'E' ];
|
|
|
@@ -64,8 +86,8 @@ class Route_Storage_AclUsage extends RouteBase {
|
|
|
UI::h('p', [], [
|
|
|
"struktura: ",
|
|
|
($acl instanceof AntAclBase)
|
|
|
- ? UI::h('a', [ 'href' => Router::getRoute('Storage_AclStruct')->getLink('', [ 'idStorage' => $acl->getDatabaseID(), 'namespace' => $acl->getNamespace() ]) ], "struktura obiektu (AntAcl)")
|
|
|
- : UI::h('a', [ 'href' => Router::getRoute('Storage_AclStruct')->getLink('tableStruct', [ 'idStorage' => $acl->getDatabaseID(), 'table' => $acl->getRootTableName() ]) ], "struktura tabeli (TableAcl)")
|
|
|
+ ? UI::h('a', [ 'href' => Router::getRoute('Storage_AclStruct')->getLink('', [ 'idStorage' => $idDatabase, 'namespace' => $aclNamespace ]) ], "struktura obiektu (AntAcl)")
|
|
|
+ : UI::h('a', [ 'href' => Router::getRoute('Storage_AclStruct')->getLink('tableStruct', [ 'idStorage' => $idDatabase, 'table' => $rootTableName ]) ], "struktura tabeli (TableAcl)")
|
|
|
]),
|
|
|
UI::h('p', [], [
|
|
|
"dodaj proces: ",
|
|
|
@@ -119,7 +141,7 @@ class Route_Storage_AclUsage extends RouteBase {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $databaseName = DB::getPDO( $acl->getDatabaseID() )->getDatabaseName();
|
|
|
+ $databaseName = DB::getPDO( $idDatabase )->getDatabaseName();
|
|
|
UI::table([
|
|
|
'caption' => "Powiązania komórek z procesem",
|
|
|
'cols_label' => $labelPermCols,
|
|
|
@@ -171,6 +193,7 @@ class Route_Storage_AclUsage extends RouteBase {
|
|
|
and ID_PROCES in({$csvIdProces})
|
|
|
group by ID_PROCES
|
|
|
");
|
|
|
+ if (empty($rows)) UI::alert('warning', "Brak danych");
|
|
|
$userIdProces = array_map( V::makePick('ID_PROCES', 0, 'int'), $rows );
|
|
|
$userTablePerms = array_reduce($aclTableRows, function ($ret, $row) use ($userIdProces, $permCols) {
|
|
|
$idProces = (int)$row['ID_PROCES'];
|