Skip to content

Commit

Permalink
Improve navigational relationships between EIS Records (cached and di…
Browse files Browse the repository at this point in the history
…rect) 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)
  • Loading branch information
arlen authored Feb 1, 2024
1 parent e74f6d7 commit 9e67f3b
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 78 deletions.
12 changes: 9 additions & 3 deletions app/resources/locales/en_US/information.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <i>View External Identity Source Record</i>."
msgstr "This is the current record retrieved directly from the source. <a href="{0}">View the latest record cached by Registry</a>."

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 <i>Retrieve from External Identity Source</i>."
msgstr "This is the latest record from the source as cached by Registry. <a href="{0}">Retrieve the current record directly from the source</a>."

msgid "ExternalIdentitySources.search.attrs.none"
msgstr "The External Identity Source cannot be searched."
Expand Down
6 changes: 6 additions & 0 deletions app/src/Model/Table/ExternalIdentityRolesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ public function initialize(array $config): void {
'AdHocAttributes',
'TelephoneNumbers'
]);

$this->setViewContains([
'Addresses',
'AdHocAttributes',
'TelephoneNumbers'
]);

$this->setAutoViewVars([
'statuses' => [
Expand Down
66 changes: 66 additions & 0 deletions app/templates/ExtIdentitySourceRecords/fields-nav.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
/**
* COmanage Registry External Identity Sources Records Navigation
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

$topLinks = [];
if(!empty($vv_obj->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;
}
56 changes: 19 additions & 37 deletions app/templates/ExtIdentitySourceRecords/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,25 @@
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/
?>
<!-- XXX This stuff should render in the form structure, below -->
<?= __d('information', 'ExternalIdentitySourceRecords.view'); ?>
<ul>
<?php if(!empty($vv_obj->external_identity_source_id)): ?>
<li><?= $this->Html->link(
__d('operation', 'ExternalIdentitySourceRecords.retrieve'),
[
'controller' => 'external-identity-sources',
'action' => 'retrieve',
$vv_obj->external_identity_source_id,
'?' => [
'source_key' => $vv_obj->source_key
]
]
); ?></li>
<li><?= $this->Html->link(
$vv_obj->external_identity_source->description,
[
'controller' => 'external-identity-sources',
'action' => 'edit',
$vv_obj->external_identity_source_id
]
); ?></li>
<?php endif; ?>
<?php if(!empty($vv_obj->external_identity_id)): ?>
<li><?= $this->Html->link(
__d('controller', 'ExternalIdentities', [1]),
[
'controller' => 'external-identities',
'action' => 'view',
$vv_obj->external_identity_id
]
); ?></li>
<?php endif; ?>
</ul>
<?php

$noticeText = __d(
'information',
'ExternalIdentitySourceRecords.view',
[
$this->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') {
Expand Down
26 changes: 25 additions & 1 deletion app/templates/ExternalIdentities/fields-nav.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 4 additions & 9 deletions app/templates/ExternalIdentities/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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',
[
Expand All @@ -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]);
Expand Down
29 changes: 19 additions & 10 deletions app/templates/ExternalIdentitySources/retrieve.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,25 @@
</div>

<!-- insert explainer box -->
<div class="alert alert-warning co-alert" role="alert">
<div class="alert-body d-flex align-items-center">
<span class="alert-title d-flex align-items-center">
<span class="material-icons-outlined alert-icon">report_problem</span>
</span>
<span class="alert-message">
<?= __d('information', 'ExternalIdentitySources.retrieve'); ?>
</span>
</div>
</div>
<?php
$noticeText = __d('information', 'ExternalIdentitySources.retrieve.notSynced');
if(!empty($vv_external_identity_record->id)) {
$noticeText = __d(
'information',
'ExternalIdentitySources.retrieve',
[
$this->Url->build(
[
'controller' => 'ext-identity-source-records',
'action' => 'view',
$vv_external_identity_record->id
]
)
]
);
}
?>
<?= $this->Alert->alert($noticeText, 'information', false) ?>

<div class="innerContent">
<div class="table-container">
Expand Down
11 changes: 1 addition & 10 deletions app/templates/ExternalIdentitySources/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,7 @@
</div>

<?php if(empty($vv_search_attrs)): ?>
<div class="alert alert-info co-alert" role="alert">
<div class="alert-body d-flex align-items-center">
<span class="alert-title d-flex align-items-center">
<span class="material-icons-outlined alert-icon">info</span>
</span>
<span class="alert-message">
<?php print __d('information', 'ExternalIdentitySources.search.attrs.none'); ?>
</span>
</div>
</div>
<?= $this->Alert->alert(__d('information', 'ExternalIdentitySources.search.attrs.none'), 'information', false) ?>
<?php else: // vv_search_attrs ?>
<?php
// Begin the form
Expand Down
4 changes: 2 additions & 2 deletions app/templates/Standard/add-edit-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@
$t['link']['?'] = $linkFilter;
}
}

if($perm) {
if($perm || !empty($t['skipPermsCheck'])) {
$action_args['vv_actions'][] = [
'order' => $this->Menu->getMenuOrder($t['order']),
'icon' => $this->Menu->getMenuIcon($t['icon']),
Expand Down
18 changes: 14 additions & 4 deletions app/templates/element/subnavigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -349,13 +356,16 @@
);
?>
</li>
<?php if($navController == 'ExternalIdentitySources' && (!empty($vv_permissions['search']) || !empty($vv_permissions['edit']))): ?>
<?php if(
($navController == 'ExternalIdentitySources' && (!empty($vv_permissions['search']) || !empty($vv_permissions['edit']))) ||
($curController == 'ExtIdentitySourceRecords' && !empty($vv_permissions['view']))
): ?>
<li class="nav-item">
<?php
$linkClass = ($active == 'search') ? 'nav-link active' : 'nav-link';
$navUrl = '/' . \Cake\Utility\Inflector::dasherize($navController) . '/search/' . $curId;
print $this->Html->link(
__d('operation', 'ExternalIdentitySources.search'),
__d('information', 'ExternalIdentitySources.records'),
$navUrl,
['class' => $linkClass]
);
Expand Down
5 changes: 4 additions & 1 deletion app/webroot/css/co-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,17 @@ body.cos.select #top-bar {
.co-alert.alert-information {
background-color: var(--cmg-color-highlight-004);
color: var(--cmg-color-highlight-003);
border-color: var(--cmg-color-link);
border-color: var(--cmg-color-highlight-017);
}
.co-alert .alert-icon {
margin-right: 0.1rem;
}
.co-alert .alert-title-text {
margin-right: 0.25em;
}
.co-alert a {
text-decoration: underline;
}
/* Alerts in the add-edit form: */
ul.form-list li.alert-banner {
display: block;
Expand Down
2 changes: 2 additions & 0 deletions app/webroot/css/co-color.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@
--cmg-color-highlight-015: #842029; /* alert: danger text color (red) */
--cmg-color-highlight-016: #f8cece; /* alert: danger border color (red) */

--cmg-color-highlight-017: #cee6f8; /* alert: info border color (blue) */

/* Duet Date Picker Colors & Settings */
--duet-color-primary: var(--cmg-color-btn-bg-001);
--duet-color-text: var(--cmg-color-body-txt);
Expand Down
2 changes: 1 addition & 1 deletion app/webroot/js/comanage/components/mvea/mvea-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default {
<!-- Urls -->
<li class="field-data-container linked-row" v-if="this.core.mveaType == 'urls'" @click="followRowLink">
<div class="field-data force-wrap">
<a :href="mveaLink" class="row-link" @click.prevent>{{ this.mvea.description != '' ? this.mvea.description : this.mvea.url }}</a>
<a :href="mveaLink" class="row-link" @click.prevent>{{ this.mvea.description != '' && this.mvea.description != null ? this.mvea.description : this.mvea.url }}</a>
<a :href="this.mvea.url" class="canvas-url-link" :title="this.txt['global.visit.link']"><span class="material-icons">north_east</span></a>
</div>
<div class="field-data data-label">
Expand Down

0 comments on commit 9e67f3b

Please sign in to comment.