Skip to content

Commit

Permalink
#1756 - Fix: Viewer of map is manageable when user lacks permission (#…
Browse files Browse the repository at this point in the history
…1757)

* #1756 - Fix: Viewer of map is manageable when user lacks permission

* Update config
  • Loading branch information
dsuren1 committed May 14, 2024
1 parent 2fad803 commit 45e6493
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
5 changes: 2 additions & 3 deletions geonode_mapstore_client/client/js/epics/gnresource.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,6 @@ export const gnManageLinkedResource = (action$, store) =>
observable$ = resourceObservable?.removeLinkedResourceObservable;
linkedResourceFn = removeLinkedResourcesByPk;
}
if (!observable$) Observable.empty();
return Observable.concat(
...(isLinkResource ? [Observable.of(setResourcePathParameters({ ...params, pk: target}))] : []),
Observable.defer(() => linkedResourceFn(source, target))
Expand All @@ -639,10 +638,10 @@ export const gnManageLinkedResource = (action$, store) =>
title: "gnviewer.linkedResource.title",
message: `gnviewer.linkedResource.message.success.${processType}`}
))
).catch(() => Observable.of(errorNotification({
)).catch(() => Observable.of(errorNotification({
title: "gnviewer.linkedResource.title",
message: `gnviewer.linkedResource.message.failure.${processType}`
}))))
})))
.let(wrapStartStop(
setControlProperty(processType, 'loading', true),
setControlProperty(processType, 'loading', false)
Expand Down
17 changes: 13 additions & 4 deletions geonode_mapstore_client/static/mapstore/configs/localConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
"name": "resourceParams",
"path": "gnresource.params"
},
{
"name": "gnResourceLinkedViewer",
"path": "gnresource.viewerLinkedResource"
},
{
"name": "layers",
"path": "layers"
Expand Down Expand Up @@ -1535,22 +1539,27 @@
"labelId": "gnviewer.editMetadata"
},
{
"type": "divider"
"type": "divider",
"disableIf": "{state('resourceParams')?.appPk}"
},
{
"type": "link",
"disableIf": "{state('resourceParams')?.appPk}",
"href": "{'#/viewer/' + 'new/map/' + state('gnResourceData')?.pk}",
"labelId": "gnviewer.addViewerConfiguration"
},
{
"type": "divider",
"disableIf": "{!state('resourceParams')?.appPk || !context.resourceHasPermission(state('gnResourceLinkedViewer'), 'change_resourcebase')}"
},
{
"type": "plugin",
"name": "EditMapViewer",
"disableIf": "{!state('resourceParams')?.appPk}"
"disableIf": "{!state('resourceParams')?.appPk || !context.resourceHasPermission(state('gnResourceLinkedViewer'), 'change_resourcebase')}",
"name": "EditMapViewer"
},
{
"type": "plugin",
"disableIf": "{!state('resourceParams')?.appPk}",
"disableIf": "{!state('resourceParams')?.appPk || !context.resourceHasPermission(state('gnResourceData'), 'delete_resourcebase') || !context.resourceHasPermission(state('gnResourceLinkedViewer'), 'delete_resourcebase')}",
"name": "RemoveMapViewer"
}
]
Expand Down

0 comments on commit 45e6493

Please sign in to comment.