|
@@ -2,6 +2,7 @@
|
|
|
// @requires $_SERVER['SERVER_NAME']
|
|
// @requires $_SERVER['SERVER_NAME']
|
|
|
|
|
|
|
|
Lib::loadClass('RouteBase');
|
|
Lib::loadClass('RouteBase');
|
|
|
|
|
+Lib::loadClass('Router');
|
|
|
Lib::loadClass('Schema_TableFactory');
|
|
Lib::loadClass('Schema_TableFactory');
|
|
|
Lib::loadClass('Response');
|
|
Lib::loadClass('Response');
|
|
|
Lib::loadClass('UI');
|
|
Lib::loadClass('UI');
|
|
@@ -620,8 +621,8 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
UI::h('div', ['class' => "p5UI__dropdown-content"], [
|
|
UI::h('div', ['class' => "p5UI__dropdown-content"], [
|
|
|
UI::h('input', ['type' => "text", 'placeholder' => "Search..", 'class' => "p5UI__dropdown-input", 'onkeyup' => "p5_Storage_actions_filterInput(this)"], null),
|
|
UI::h('input', ['type' => "text", 'placeholder' => "Search..", 'class' => "p5UI__dropdown-input", 'onkeyup' => "p5_Storage_actions_filterInput(this)"], null),
|
|
|
UI::h('a', [ 'href' => $item['reinstallLink'] ], "reinstall"),
|
|
UI::h('a', [ 'href' => $item['reinstallLink'] ], "reinstall"),
|
|
|
- UI::h('a', [ 'href' => $this->getLink('tableStruct', [ 'idStorage' => $idStorage, 'table' => $item['name'] ]) ], "struktura"),
|
|
|
|
|
- UI::h('a', [ 'href' => $this->getLink('objectStruct', [ 'idStorage' => $idStorage, 'namespace' => $item['namespace'] ]) ], "obj struct"),
|
|
|
|
|
|
|
+ UI::h('a', [ 'href' => $this->getLink('tableStruct', [ 'idStorage' => $idStorage, 'table' => $item['name'] ]) ], "struktura tabeli (TableAcl)"),
|
|
|
|
|
+ UI::h('a', [ 'href' => $this->getLink('objectStruct', [ 'idStorage' => $idStorage, 'namespace' => $item['namespace'] ]) ], "struktura obiektu (AntAcl)"),
|
|
|
UI::h('a', [ 'href' => $this->getLink('rawInfo', [ 'idStorage' => $idStorage, 'table' => $item['name'] ]) ], "raw info"),
|
|
UI::h('a', [ 'href' => $this->getLink('rawInfo', [ 'idStorage' => $idStorage, 'table' => $item['name'] ]) ], "raw info"),
|
|
|
UI::h('a', [ 'href' => Router::getRoute('ViewTableAjax')->getLink('', ['namespace' => $item['namespace']]) ], "view table"),
|
|
UI::h('a', [ 'href' => Router::getRoute('ViewTableAjax')->getLink('', ['namespace' => $item['namespace']]) ], "view table"),
|
|
|
UI::h('a', [ 'href' => Router::getRoute('ViewObject')->getLink('', ['namespace' => $item['namespace']]) ], "view object"),
|
|
UI::h('a', [ 'href' => Router::getRoute('ViewObject')->getLink('', ['namespace' => $item['namespace']]) ], "view object"),
|
|
@@ -735,20 +736,12 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
}, $activeRefFields
|
|
}, $activeRefFields
|
|
|
)
|
|
)
|
|
|
) ];
|
|
) ];
|
|
|
- DBG::nicePrint($item, '$item');
|
|
|
|
|
- DBG::nicePrint($refFields, '$refFields');
|
|
|
|
|
DBG::nicePrint($query, '$query');
|
|
DBG::nicePrint($query, '$query');
|
|
|
|
|
|
|
|
- // $refTableCom = ACL::getRefTable('default_db/BI_audit_KRS/BI_audit_KRS', 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company');
|
|
|
|
|
- // $refTablePer = ACL::getRefTable('default_db/BI_audit_KRS/BI_audit_KRS', 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person');
|
|
|
|
|
- // echo UI::h('pre', [], "
|
|
|
|
|
- // Tabela `{$refTableCom}`: 'default_db/BI_audit_KRS/BI_audit_KRS' ref do 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company'
|
|
|
|
|
- // Tablea `{$refTablePer}`: 'default_db/BI_audit_KRS/BI_audit_KRS' ref do 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person'
|
|
|
|
|
- // ");
|
|
|
|
|
- $krsItems = ACL::getAclByNamespace($namespace)->buildQuery($query)->getItems([
|
|
|
|
|
|
|
+ $previewItems = ACL::getAclByNamespace($namespace)->buildQuery($query)->getItems([
|
|
|
'limit' => 3
|
|
'limit' => 3
|
|
|
]);
|
|
]);
|
|
|
- DBG::nicePrint($krsItems, '$krsItems - limit 10');
|
|
|
|
|
|
|
+ DBG::nicePrint($previewItems, 'items with ref limit 3');
|
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
DBG::log($e);
|
|
DBG::log($e);
|
|
|
UI::alert('danger', $e->getMessage());
|
|
UI::alert('danger', $e->getMessage());
|
|
@@ -862,39 +855,40 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
' ',
|
|
' ',
|
|
|
UI::h('a', [
|
|
UI::h('a', [
|
|
|
'href' => "index.php?_route=ViewTableAjax&namespace={$item['namespace']}",
|
|
'href' => "index.php?_route=ViewTableAjax&namespace={$item['namespace']}",
|
|
|
- 'class' => "btn btn-md btn-link"
|
|
|
|
|
|
|
+ 'class' => "btn btn-sm btn-link"
|
|
|
], "Przeglądaj tabelę"),
|
|
], "Przeglądaj tabelę"),
|
|
|
- ' ',
|
|
|
|
|
( ($item['idZasob'] > 0)
|
|
( ($item['idZasob'] > 0)
|
|
|
? UI::h('a', [
|
|
? UI::h('a', [
|
|
|
'href' => "procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id={$item['idZasob']}&filtr_ids=%2B&filtr_ob=%2B",
|
|
'href' => "procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id={$item['idZasob']}&filtr_ids=%2B&filtr_ob=%2B",
|
|
|
- 'class' => "btn btn-md btn-link",
|
|
|
|
|
|
|
+ 'class' => "btn btn-sm btn-link",
|
|
|
'title' => "Struktura tabeli w drzewie zasobów"
|
|
'title' => "Struktura tabeli w drzewie zasobów"
|
|
|
], "Zasoby")
|
|
], "Zasoby")
|
|
|
: ''
|
|
: ''
|
|
|
),
|
|
),
|
|
|
- ' ',
|
|
|
|
|
( ($item['idZasob'] > 0)
|
|
( ($item['idZasob'] > 0)
|
|
|
? UI::h('a', [
|
|
? UI::h('a', [
|
|
|
'href' => "index.php?FUNCTION_INIT=PROCES_MENU&HEADER_NOT_INIT=YES&_task=PROCES_FOR_TABLE&tblId={$item['idZasob']}",
|
|
'href' => "index.php?FUNCTION_INIT=PROCES_MENU&HEADER_NOT_INIT=YES&_task=PROCES_FOR_TABLE&tblId={$item['idZasob']}",
|
|
|
- 'class' => "btn btn-md btn-link",
|
|
|
|
|
|
|
+ 'class' => "btn btn-sm btn-link",
|
|
|
'title' => "Procesy dla aktualnie przeglądanej tabeli"
|
|
'title' => "Procesy dla aktualnie przeglądanej tabeli"
|
|
|
], "Procesy")
|
|
], "Procesy")
|
|
|
: ''
|
|
: ''
|
|
|
),
|
|
),
|
|
|
- ' ',
|
|
|
|
|
UI::h('a', [
|
|
UI::h('a', [
|
|
|
'href' => $this->getLink('objectReinstall', ['namespace' => $item['namespace']]),
|
|
'href' => $this->getLink('objectReinstall', ['namespace' => $item['namespace']]),
|
|
|
- 'class' => 'btn btn-link', 'style' => "color:#f00",
|
|
|
|
|
|
|
+ 'class' => 'btn btn-sm btn-link', 'style' => "color:#f00",
|
|
|
'title' => "Zainstaluje ponownie obiekt"
|
|
'title' => "Zainstaluje ponownie obiekt"
|
|
|
], "reinstall object"),
|
|
], "reinstall object"),
|
|
|
- ' ',
|
|
|
|
|
- UI::hButtonPost("(podgląd)", [
|
|
|
|
|
|
|
+ UI::h('a', [
|
|
|
|
|
+ 'href' => Router::getRoute('Storage_AclUsage')->getLink('', [ 'namespace' => $item['namespace'] ]),
|
|
|
|
|
+ 'class' => "btn btn-sm btn-link",
|
|
|
|
|
+ 'title' => "Uprawnienia - analiza użycia komórek w procesach"
|
|
|
|
|
+ ], "Uprawnienia (analiza użycia)"),
|
|
|
|
|
+ UI::hButtonPost("(podgląd z relacjami)", [
|
|
|
'data' => [
|
|
'data' => [
|
|
|
'_postTask' => 'preview'
|
|
'_postTask' => 'preview'
|
|
|
],
|
|
],
|
|
|
- 'class' => 'btn btn-link', 'style' => "color:#bbb",
|
|
|
|
|
- 'title' => "Podgląd kilku ostatnich obiektów"
|
|
|
|
|
|
|
+ 'class' => 'btn btn-sm btn-link', 'style' => "font-style:italic",
|
|
|
|
|
+ 'title' => "Podgląd kilku ostatnich obiektów wraz z relacjami"
|
|
|
]),
|
|
]),
|
|
|
]),
|
|
]),
|
|
|
'rows' => array_map(function ($field) use ($item, $thisGetLink) {
|
|
'rows' => array_map(function ($field) use ($item, $thisGetLink) {
|
|
@@ -971,152 +965,6 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
UI::dol();
|
|
UI::dol();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function aclUsageAction() {
|
|
|
|
|
- UI::gora();
|
|
|
|
|
- UI::menu();
|
|
|
|
|
- UI::startContainer();
|
|
|
|
|
- try {
|
|
|
|
|
- $namespace = V::get('namespace', '', $_GET, 'word');
|
|
|
|
|
- if (!$namespace) {
|
|
|
|
|
- $typeName = V::get('typeName', '', $_GET, 'word');
|
|
|
|
|
- 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)));
|
|
|
|
|
-
|
|
|
|
|
- $tableName = $acl->getName();
|
|
|
|
|
- $idTable = $acl->getID();
|
|
|
|
|
-
|
|
|
|
|
- UI::tag('h2', [], "Uprawnienia tabeli '{$tableName}'");
|
|
|
|
|
- UI::tag('p', [], "ID Zasobu [{$idTable}]");
|
|
|
|
|
- if ($idTable > 0) {
|
|
|
|
|
- $aclTableRows = DB::getPDO()->fetchAll("select * from `CRM_PROCES_idx_TABLE_TO_PROCES_PERMS_VIEW` where ID_TABLE = {$idTable}");
|
|
|
|
|
- UI::startTag('details');
|
|
|
|
|
- echo UI::h('summary', ['style'=>"cursor:pointer"], "Wszystkie powiązania komórek z procesami - szczegóły");
|
|
|
|
|
- UI::table([
|
|
|
|
|
- 'rows' => array_map(function ($row) {
|
|
|
|
|
- $splitPos = strpos($row['TABLE_DESCRIPTION'], ' ', 20);
|
|
|
|
|
- if ($splitPos > 30) $splitPos = 20;
|
|
|
|
|
- $row['TABLE_DESCRIPTION'] = UI::h('details', [], [
|
|
|
|
|
- UI::h('summary', [ 'style' => "white-space:nowrap" ], substr($row['TABLE_DESCRIPTION'], 0, $splitPos)),
|
|
|
|
|
- UI::h('p', [], substr($row['TABLE_DESCRIPTION'], $splitPos)),
|
|
|
|
|
- ]);
|
|
|
|
|
- return $row;
|
|
|
|
|
- }, $aclTableRows)
|
|
|
|
|
- ]);
|
|
|
|
|
- UI::endTag('details');
|
|
|
|
|
-
|
|
|
|
|
- $csvIdProces = array();
|
|
|
|
|
- foreach ($aclTableRows as $row) {
|
|
|
|
|
- if (!in_array($row['ID_PROCES'], $csvIdProces)) $csvIdProces[] = $row['ID_PROCES'];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $databaseName = DB::getPDO()->getDatabaseName();
|
|
|
|
|
- UI::table([
|
|
|
|
|
- 'caption' => "Powiązania komórek z procesem",
|
|
|
|
|
- 'rows' => array_map(
|
|
|
|
|
- function ($row) use ($aclTableRows, $idTable) {
|
|
|
|
|
- $fieldName = $row['COLUMN_NAME'];
|
|
|
|
|
- $item = [];
|
|
|
|
|
- $item['name'] = $fieldName;
|
|
|
|
|
- $item['typ'] = UI::h('details', [], [
|
|
|
|
|
- UI::h('summary', ['style'=>"cursor:pointer"], $row['DATA_TYPE']),
|
|
|
|
|
- UI::h('p', [], $row['COLUMN_TYPE']),
|
|
|
|
|
- ]);
|
|
|
|
|
- $item['w procesie'] = array();
|
|
|
|
|
- $item['id_zasob'] = 0;
|
|
|
|
|
- $item['PERM_R'] = 0;
|
|
|
|
|
- $item['PERM_W'] = 0;
|
|
|
|
|
- $item['PERM_X'] = 0;
|
|
|
|
|
- $item['PERM_C'] = 0;
|
|
|
|
|
- $item['PERM_S'] = 0;
|
|
|
|
|
- $item['PERM_O'] = 0;
|
|
|
|
|
- $item['PERM_V'] = 0;
|
|
|
|
|
- $item['PERM_E'] = 0;
|
|
|
|
|
- foreach ($aclTableRows as $aclInfo) {
|
|
|
|
|
- if (strtolower($aclInfo['CELL_NAME']) == strtolower($row['COLUMN_NAME'])) {
|
|
|
|
|
- $item['w procesie'][] = $aclInfo['ID_PROCES'];
|
|
|
|
|
- $item['id_zasob'] = $aclInfo['ID_CELL'];
|
|
|
|
|
- $item['PERM_R'] += $aclInfo['PERM_R'];
|
|
|
|
|
- $item['PERM_W'] += $aclInfo['PERM_W'];
|
|
|
|
|
- $item['PERM_X'] += $aclInfo['PERM_X'];
|
|
|
|
|
- $item['PERM_C'] += $aclInfo['PERM_C'];
|
|
|
|
|
- $item['PERM_S'] += $aclInfo['PERM_S'];
|
|
|
|
|
- $item['PERM_O'] += $aclInfo['PERM_O'];
|
|
|
|
|
- $item['PERM_V'] += $aclInfo['PERM_V'];
|
|
|
|
|
- $item['PERM_E'] += $aclInfo['PERM_E'];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- $item['w procesie'] = (empty($item['w procesie']))
|
|
|
|
|
- ? "<i style=\"color:red\">Brak</i>"
|
|
|
|
|
- : UI::h('span', ['style'=>"white-space:nowrap"], implode(", ", $item['w procesie']));
|
|
|
|
|
- if (!$item['id_zasob']) $item['id_zasob'] = DB::getPDO()->fetchValue("select ID from CRM_LISTA_ZASOBOW where `DESC` = '{$fieldName}' and PARENT_ID = {$idTable} limit 1");
|
|
|
|
|
- $item['id_zasob'] = ($item['id_zasob']) ? $item['id_zasob'] : UI::h('i', ['style'=>"color:silver"], "Brak");
|
|
|
|
|
- return $item;
|
|
|
|
|
- }, DB::getPDO()->fetchAll("
|
|
|
|
|
- select t.COLUMN_NAME, t.DATA_TYPE, t.COLUMN_TYPE
|
|
|
|
|
- from `information_schema`.`COLUMNS` t
|
|
|
|
|
- where t.TABLE_SCHEMA = '{$databaseName}'
|
|
|
|
|
- and t.TABLE_NAME like '{$tableName}'
|
|
|
|
|
- ")
|
|
|
|
|
- )
|
|
|
|
|
- ]);
|
|
|
|
|
-
|
|
|
|
|
- if (!empty($csvIdProces)) {
|
|
|
|
|
- $userLogin = User::getLogin();
|
|
|
|
|
- $csvIdProces = implode(",", $csvIdProces);
|
|
|
|
|
- UI::tag('h4', ['style'=>"margin-top:40px"], "Procesy dla '{$userLogin}': [{$csvIdProces}] <small><i>(z tabeli CRM_PROCES_idx_USER_to_PROCES_VIEW)</i></small>");
|
|
|
|
|
- $rows = DB::getPDO()->fetchAll("
|
|
|
|
|
- select ID_PROCES
|
|
|
|
|
- from `CRM_PROCES_idx_USER_to_PROCES_VIEW`
|
|
|
|
|
- where ADM_ACCOUNT = '{$userLogin}'
|
|
|
|
|
- and ID_PROCES in({$csvIdProces})
|
|
|
|
|
- group by ID_PROCES
|
|
|
|
|
- ");
|
|
|
|
|
- $userIdProces = array(); foreach ($rows as $row) $userIdProces[] = $row['ID_PROCES'];
|
|
|
|
|
- $userTablePerms = array();
|
|
|
|
|
- foreach ($aclTableRows as $row) {
|
|
|
|
|
- if (!in_array($row['ID_PROCES'], $userIdProces)) continue;
|
|
|
|
|
- if (array_key_exists($row['CELL_NAME'], $userTablePerms)) {
|
|
|
|
|
- $userTablePerms[ $row['CELL_NAME'] ]['w procesie'] .= ",{$row['ID_PROCES']}";
|
|
|
|
|
- $userTablePerms[ $row['CELL_NAME'] ][ 'PERM_R' ] += $row['PERM_R'];
|
|
|
|
|
- $userTablePerms[ $row['CELL_NAME'] ][ 'PERM_W' ] += $row['PERM_W'];
|
|
|
|
|
- $userTablePerms[ $row['CELL_NAME'] ][ 'PERM_X' ] += $row['PERM_X'];
|
|
|
|
|
- $userTablePerms[ $row['CELL_NAME'] ][ 'PERM_C' ] += $row['PERM_C'];
|
|
|
|
|
- $userTablePerms[ $row['CELL_NAME'] ][ 'PERM_S' ] += $row['PERM_S'];
|
|
|
|
|
- $userTablePerms[ $row['CELL_NAME'] ][ 'PERM_O' ] += $row['PERM_O'];
|
|
|
|
|
- $userTablePerms[ $row['CELL_NAME'] ][ 'PERM_V' ] += $row['PERM_V'];
|
|
|
|
|
- $userTablePerms[ $row['CELL_NAME'] ][ 'PERM_E' ] += $row['PERM_E'];
|
|
|
|
|
- } else {
|
|
|
|
|
- $userTablePerms[ $row['CELL_NAME'] ] = [
|
|
|
|
|
- 'fieldName' => $row['CELL_NAME'],
|
|
|
|
|
- 'zasob' => $row['ID_CELL'],
|
|
|
|
|
- 'w procesie' => "{$row['ID_PROCES']}",
|
|
|
|
|
- 'PERM_R' => $row['PERM_R'],
|
|
|
|
|
- 'PERM_W' => $row['PERM_W'],
|
|
|
|
|
- 'PERM_X' => $row['PERM_X'],
|
|
|
|
|
- 'PERM_C' => $row['PERM_C'],
|
|
|
|
|
- 'PERM_S' => $row['PERM_S'],
|
|
|
|
|
- 'PERM_O' => $row['PERM_O'],
|
|
|
|
|
- 'PERM_V' => $row['PERM_V'],
|
|
|
|
|
- 'PERM_E' => $row['PERM_E'],
|
|
|
|
|
- ];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- UI::table([
|
|
|
|
|
- 'caption' => "Uprawniena dla usera '{$userLogin}'",
|
|
|
|
|
- 'rows' => $userTablePerms
|
|
|
|
|
- ]);
|
|
|
|
|
- } else UI::alert('warning', "brak \$csvIdProces");
|
|
|
|
|
- } catch (Exception $e) {
|
|
|
|
|
- UI::alert('danger', $e->getMessage());
|
|
|
|
|
- DBG::log($e);
|
|
|
|
|
- }
|
|
|
|
|
- UI::endContainer();
|
|
|
|
|
- UI::dol();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
public function tableStructAction() {
|
|
public function tableStructAction() {
|
|
|
UI::gora();
|
|
UI::gora();
|
|
|
UI::menu();
|
|
UI::menu();
|
|
@@ -1230,7 +1078,7 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
'title' => "Procesy dla aktualnie przeglądanej tabeli"
|
|
'title' => "Procesy dla aktualnie przeglądanej tabeli"
|
|
|
], "Procesy"),
|
|
], "Procesy"),
|
|
|
UI::h('a', [
|
|
UI::h('a', [
|
|
|
- 'href' => $this->getLink('aclUsage', [ 'namespace' => "default_db/{$tblName}" ]),
|
|
|
|
|
|
|
+ 'href' => Router::getRoute('Storage_AclUsage')->getLink('', [ 'namespace' => "default_db/{$tblName}" ]),
|
|
|
'class' => "btn btn-md btn-link",
|
|
'class' => "btn btn-md btn-link",
|
|
|
'title' => "Uprawnienia - analiza użycia komórek w procesach"
|
|
'title' => "Uprawnienia - analiza użycia komórek w procesach"
|
|
|
], "Uprawnienia (analiza użycia)"),
|
|
], "Uprawnienia (analiza użycia)"),
|