From: Stephen Smith Date: Wed, 1 Dec 2021 00:20:27 +0000 (-0500) Subject: 18123: Disable delete group link if user lacks permission. X-Git-Tag: 2.4.0~22^2~14 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/a3658215b1129e78e2dfd7496e1d5de8263b2351 18123: Disable delete group link if user lacks permission. Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx index 39893392..457de504 100644 --- a/src/views-components/data-explorer/renderers.tsx +++ b/src/views-components/data-explorer/renderers.tsx @@ -403,13 +403,19 @@ export const ResourceLinkTailUuid = connect( return tailResource || { uuid: '' }; })(renderUuid); -const renderLinkDelete = (dispatch: Dispatch, item: LinkResource) => { +const renderLinkDelete = (dispatch: Dispatch, item: LinkResource, canManage: boolean) => { if (item.uuid) { - return - dispatch(openRemoveGroupMemberDialog(item.uuid))}> - - - ; + return canManage ? + + dispatch(openRemoveGroupMemberDialog(item.uuid))}> + + + : + + + + + ; } else { return ; } @@ -419,10 +425,11 @@ export const ResourceLinkDelete = connect( (state: RootState, props: { uuid: string }) => { const link = getResource(props.uuid)(state.resources); return { - item: link || { uuid: '', kind: ResourceKind.NONE } + item: link || { uuid: '', kind: ResourceKind.NONE }, + canManage: link && getResourceLinkCanManage(state, link), }; - })((props: { item: LinkResource } & DispatchProp) => - renderLinkDelete(props.dispatch, props.item)); + })((props: { item: LinkResource, canManage: boolean } & DispatchProp) => + renderLinkDelete(props.dispatch, props.item, props.canManage)); export const ResourceLinkTailEmail = connect( (state: RootState, props: { uuid: string }) => {