Skip to content

fix_toplink_hardcoded_permissions #152

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/src/Model/Table/ExtIdentitySourceRecordsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ public function initialize(array $config): void {
// Actions that operate over a table (ie: do not require an $id)
'table' => [
'add' => false,
// CFM-32 Update this permission when made available via the Artifacts menu
'index' => false // ['platformAdmin', 'coAdmin'],
'index' => ['platformAdmin', 'coAdmin']
]
]);
}
Expand Down
15 changes: 15 additions & 0 deletions app/src/Model/Table/ExternalIdentitiesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ public function initialize(array $config): void {
'table' => [
'add' => ['platformAdmin', 'coAdmin'],
'index' => ['platformAdmin', 'coAdmin']
],
// Related models whose permissions we'll need, typically for table views
'related' => [
'Names',
'Addresses',
'AdHocAttributes',
'EmailAddresses',
'ExternalIdentityRoles',
'ExtIdentitySourceRecords',
'HistoryRecords',
'Identifiers',
'JobHistoryRecords',
'Pronouns',
'TelephoneNumbers',
'Urls'
]
]);
}
Expand Down
6 changes: 2 additions & 4 deletions app/templates/ExtIdentitySourceRecords/fields-nav.inc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ if(!empty($vv_obj->external_identity_id)) {
'controller' => 'external_identities',
'action' => 'view',
$vv_obj->external_identity_id
],
'skipPermsCheck' => true
]
];
$topLinks[] = [
'icon' => 'visibility',
Expand All @@ -49,8 +48,7 @@ if(!empty($vv_obj->external_identity_id)) {
'?' => [
'source_key' => $vv_obj->source_key
]
],
'skipPermsCheck' => true
]
];
}

Expand Down
19 changes: 2 additions & 17 deletions app/templates/ExternalIdentities/fields-nav.inc
Original file line number Diff line number Diff line change
Expand Up @@ -53,34 +53,19 @@ $topLinks = [
'?' => [
'external_identity_id' => $vv_obj->id
]
],
'skipPermsCheck' => true
]
],
[
'icon' => 'visibility',
'order' => 'Default',
'label' => __d('operation', 'view.a', [__d('controller', 'ExtIdentitySourceRecords', 1)]),
'link' => [
'controller' => 'ext_identity_source_records',
'action' => 'index',
'action' => 'view',
$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
2 changes: 1 addition & 1 deletion app/templates/Standard/add-edit-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
}
}

if($perm || !empty($t['skipPermsCheck'])) {
if($perm) {
$action_args['vv_actions'][] = [
'order' => $this->Menu->getMenuOrder($t['order']),
'icon' => $this->Menu->getMenuIcon($t['icon']),
Expand Down