From 9e67f3b094289e53ef639198fc58beb4f7c06b38 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Thu, 1 Feb 2024 10:25:44 -0500 Subject: [PATCH] Improve navigational relationships between EIS Records (cached and direct) and External Identities. Make subnavigation and topLinks more flexible to accommodate cross-model navigation. (CFM-363) (#151) * Improve navigational relationships between EIS Records (cached and direct) and External Identities. Make subnavigation and topLinks more flexible to accommodate cross-model navigation. (CFM-363) * Fix rendering of URL MVEA in External Identity canvas (CFM-363) * Allow rendering of MVEAs on External Identity Roles canvas view (CFM-363) --- app/resources/locales/en_US/information.po | 12 +++- .../Table/ExternalIdentityRolesTable.php | 6 ++ .../ExtIdentitySourceRecords/fields-nav.inc | 66 +++++++++++++++++++ .../ExtIdentitySourceRecords/fields.inc | 56 ++++++---------- .../ExternalIdentities/fields-nav.inc | 26 +++++++- app/templates/ExternalIdentities/fields.inc | 13 ++-- .../ExternalIdentitySources/retrieve.php | 29 +++++--- .../ExternalIdentitySources/search.php | 11 +--- app/templates/Standard/add-edit-view.php | 4 +- app/templates/element/subnavigation.php | 18 +++-- app/webroot/css/co-base.css | 5 +- app/webroot/css/co-color.css | 2 + .../js/comanage/components/mvea/mvea-item.js | 2 +- 13 files changed, 172 insertions(+), 78 deletions(-) create mode 100644 app/templates/ExtIdentitySourceRecords/fields-nav.inc diff --git a/app/resources/locales/en_US/information.po b/app/resources/locales/en_US/information.po index 73edccf50..6a05a1458 100644 --- a/app/resources/locales/en_US/information.po +++ b/app/resources/locales/en_US/information.po @@ -55,16 +55,22 @@ msgid "pagination.format" msgstr "Page {{page}} of {{pages}}, Viewing {{start}}-{{end}} of {{count}}" msgid "ExternalIdentities.source" -msgstr "This External Identity was created from {0} ({1})" +msgstr "This External Identity was created from {0}." + +msgid "ExternalIdentitySources.records" +msgstr "Source Records" msgid "ExternalIdentitySources.retrieve" -msgstr "This is the current record available directly from the source. To view the latest record retrieved and cached by Registry, click View External Identity Source Record." +msgstr "This is the current record retrieved directly from the source. View the latest record cached by Registry." + +msgid "ExternalIdentitySources.retrieve.notSynced" +msgstr "This is the current record available directly from the source." msgid "ExternalIdentitySourceRecords.metadata" msgstr "Metadata" msgid "ExternalIdentitySourceRecords.view" -msgstr "This is the latest record retrieved from the source, as cached by Registry. To view the current record directly from the source, select Retrieve from External Identity Source." +msgstr "This is the latest record from the source as cached by Registry. Retrieve the current record directly from the source." msgid "ExternalIdentitySources.search.attrs.none" msgstr "The External Identity Source cannot be searched." diff --git a/app/src/Model/Table/ExternalIdentityRolesTable.php b/app/src/Model/Table/ExternalIdentityRolesTable.php index 86132973c..b24377067 100644 --- a/app/src/Model/Table/ExternalIdentityRolesTable.php +++ b/app/src/Model/Table/ExternalIdentityRolesTable.php @@ -100,6 +100,12 @@ public function initialize(array $config): void { 'AdHocAttributes', 'TelephoneNumbers' ]); + + $this->setViewContains([ + 'Addresses', + 'AdHocAttributes', + 'TelephoneNumbers' + ]); $this->setAutoViewVars([ 'statuses' => [ diff --git a/app/templates/ExtIdentitySourceRecords/fields-nav.inc b/app/templates/ExtIdentitySourceRecords/fields-nav.inc new file mode 100644 index 000000000..8ea739688 --- /dev/null +++ b/app/templates/ExtIdentitySourceRecords/fields-nav.inc @@ -0,0 +1,66 @@ +external_identity_id)) { + $topLinks[] = [ + 'icon' => 'visibility', + 'order' => 'Default', + 'label' => __d('operation', 'view.a', [__d('controller', 'ExternalIdentities', [1])]), + 'link' => [ + 'controller' => 'external_identities', + 'action' => 'view', + $vv_obj->external_identity_id + ], + 'skipPermsCheck' => true + ]; + $topLinks[] = [ + 'icon' => 'visibility', + 'order' => 'Default', + 'label' => __d('operation', 'ExternalIdentitySourceRecords.retrieve'), + 'link' => [ + 'controller' => 'external_identity_sources', + 'action' => 'retrieve', + $vv_obj->external_identity_source_id, + '?' => [ + 'source_key' => $vv_obj->source_key + ] + ], + 'skipPermsCheck' => true + ]; +} + +$subnav = [ + 'name' => 'plugin', + 'active' => 'search' +]; + +if(!empty($vv_obj->external_identity_source_id)) { + $subnav['tabsId'] = $vv_obj->external_identity_source_id; + $subnav['tabsController'] = 'external_identity_sources'; + $subnav['tabsSupertitle'] = $vv_obj->external_identity_source->description; +} \ No newline at end of file diff --git a/app/templates/ExtIdentitySourceRecords/fields.inc b/app/templates/ExtIdentitySourceRecords/fields.inc index 68be3473a..59d62580c 100644 --- a/app/templates/ExtIdentitySourceRecords/fields.inc +++ b/app/templates/ExtIdentitySourceRecords/fields.inc @@ -24,43 +24,25 @@ * @since COmanage Registry v5.0.0 * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) */ -?> - - - -Url->build( + [ + 'controller' => 'external_identity_sources', + 'action' => 'retrieve', + $vv_obj->external_identity_source_id, + '?' => [ + 'source_key' => $vv_obj->source_key + ] + ] + ) + ] +); + +print $this->Alert->alert($noticeText, 'information', false); // This view does not support add or edit if($vv_action == 'view') { diff --git a/app/templates/ExternalIdentities/fields-nav.inc b/app/templates/ExternalIdentities/fields-nav.inc index 745e3b332..5a0533b3b 100644 --- a/app/templates/ExternalIdentities/fields-nav.inc +++ b/app/templates/ExternalIdentities/fields-nav.inc @@ -54,9 +54,33 @@ $topLinks = [ 'external_identity_id' => $vv_obj->id ] ], - 'class' => '' + 'skipPermsCheck' => true + ], + [ + 'icon' => 'visibility', + 'order' => 'Default', + 'label' => __d('operation', 'view.a', [__d('controller', 'ExtIdentitySourceRecords', 1)]), + 'link' => [ + 'controller' => 'ext_identity_source_records', + 'action' => 'index', + $vv_obj->ext_identity_source_records[0]->id + ] ] ]; + +if($vv_action == 'view' && !empty($vv_obj->ext_identity_source_records[0])) { + $topLinks[] = [ + 'icon' => 'visibility', + 'order' => 'Default', + 'label' => __d('operation', 'view.a', [__d('controller', 'ExtIdentitySourceRecords', 1)]), + 'link' => [ + 'controller' => 'ext-identity-source-records', + 'action' => 'view', + $vv_obj->ext_identity_source_records[0]->id + ], + 'skipPermsCheck' => true + ]; +} // $addMenuLinks is also given slightly different treatment from the typical $topLinks found in most views: // it is a page-global menu used for adding MVEAs and is given special treatment in element/mveaCanvas.php. diff --git a/app/templates/ExternalIdentities/fields.inc b/app/templates/ExternalIdentities/fields.inc index 7b4a573c5..cb7f442c7 100644 --- a/app/templates/ExternalIdentities/fields.inc +++ b/app/templates/ExternalIdentities/fields.inc @@ -28,7 +28,8 @@ // This view will not support add/edit if($vv_action == 'add' || $vv_action == 'edit' || $vv_action == 'view') { if(!empty($vv_obj->ext_identity_source_records[0])) { - print __d( + + $noticeText = __d( 'information', 'ExternalIdentities.source', [ @@ -39,17 +40,11 @@ if($vv_action == 'add' || $vv_action == 'edit' || $vv_action == 'view') { 'action' => 'edit', $vv_obj->ext_identity_source_records[0]->external_identity_source->id ] - ), - $this->Html->link( - __d('operation', 'view.a', [__d('controller', 'ExtIdentitySourceRecords', 1)]), - [ - 'controller' => 'ext-identity-source-records', - 'action' => 'view', - $vv_obj->ext_identity_source_records[0]->id - ] ) ] ); + + print $this->Alert->alert($noticeText, 'information', false); } print $this->Field->control('status', ['empty' => false]); diff --git a/app/templates/ExternalIdentitySources/retrieve.php b/app/templates/ExternalIdentitySources/retrieve.php index d872ddd46..b50364847 100644 --- a/app/templates/ExternalIdentitySources/retrieve.php +++ b/app/templates/ExternalIdentitySources/retrieve.php @@ -87,16 +87,25 @@ - +id)) { + $noticeText = __d( + 'information', + 'ExternalIdentitySources.retrieve', + [ + $this->Url->build( + [ + 'controller' => 'ext-identity-source-records', + 'action' => 'view', + $vv_external_identity_record->id + ] + ) + ] + ); + } +?> +Alert->alert($noticeText, 'information', false) ?>
diff --git a/app/templates/ExternalIdentitySources/search.php b/app/templates/ExternalIdentitySources/search.php index 585ad1269..a7b841cec 100644 --- a/app/templates/ExternalIdentitySources/search.php +++ b/app/templates/ExternalIdentitySources/search.php @@ -42,16 +42,7 @@
- + Alert->alert(__d('information', 'ExternalIdentitySources.search.attrs.none'), 'information', false) ?> $this->Menu->getMenuOrder($t['order']), 'icon' => $this->Menu->getMenuIcon($t['icon']), diff --git a/app/templates/element/subnavigation.php b/app/templates/element/subnavigation.php index 5f4c05f9a..0a6f50907 100644 --- a/app/templates/element/subnavigation.php +++ b/app/templates/element/subnavigation.php @@ -51,7 +51,11 @@ // XXX we might produce the $vv_primary_link for edit views so the approach below could be deprecated // XXX $vv_primary_link_obj is the equivalent for plugins however $curId = $vv_obj->id; - if(!empty($vv_person_id)) { + if(!empty($tabsId) && !empty($tabsController)) { + // these have been explicitly set in the $subnav array in fields-nav.inc, so just use them. + $curId = $tabsId; + $navController = $tabsController; + } elseif(!empty($vv_person_id)) { $curId = $vv_person_id; } elseif($active == 'plugin' && !empty($vv_primary_link_obj) && !empty($vv_primary_link_model)) { $curId = $vv_primary_link_obj->id; @@ -83,7 +87,10 @@ } $supertitle = __d('information','global.title.none'); -if($active == 'plugin' && !empty($vv_bc_parent_obj)) { +if(!empty($tabsSupertitle)) { + // this has been explicitly set in the $subnav array in fields-nav.inc, so just use it. + $supertitle = $tabsSupertitle; +} elseif($active == 'plugin' && !empty($vv_bc_parent_obj)) { $supertitle = $vv_bc_parent_obj->$vv_bc_parent_displayfield; } elseif(!empty($vv_person_name)) { $supertitle = $vv_person_name->full_name; @@ -349,13 +356,16 @@ ); ?> - +