[ARVADOS-WORKBENCH2] updated: 2.2.1-130-g4b001444

Git user git at public.arvados.org
Wed Nov 17 02:11:07 UTC 2021


Summary of changes:
 .../group-details-panel/group-details-panel.tsx     | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

       via  4b001444641853b3053ca26dbc7225c404dfd11c (commit)
      from  a2c8bda113085f0fa484cbe881c533718139d3b6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 4b001444641853b3053ca26dbc7225c404dfd11c
Author: Stephen Smith <stephen at curii.com>
Date:   Tue Nov 16 21:10:28 2021 -0500

    18123: Hide add member button unless the user can_manage the group.
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/src/views/group-details-panel/group-details-panel.tsx b/src/views/group-details-panel/group-details-panel.tsx
index 7b06a693..bade28cb 100644
--- a/src/views/group-details-panel/group-details-panel.tsx
+++ b/src/views/group-details-panel/group-details-panel.tsx
@@ -11,13 +11,15 @@ import { ResourceLinkHeadUuid, ResourceLinkTailUuid, ResourceLinkTailEmail, Reso
 import { createTree } from 'models/tree';
 import { noop } from 'lodash/fp';
 import { RootState } from 'store/store';
-import { GROUP_DETAILS_MEMBERS_PANEL_ID, GROUP_DETAILS_PERMISSIONS_PANEL_ID, openAddGroupMembersDialog } from 'store/group-details-panel/group-details-panel-actions';
+import { GROUP_DETAILS_MEMBERS_PANEL_ID, GROUP_DETAILS_PERMISSIONS_PANEL_ID, openAddGroupMembersDialog, getCurrentGroupDetailsPanelUuid } from 'store/group-details-panel/group-details-panel-actions';
 import { openContextMenu } from 'store/context-menu/context-menu-actions';
 import { ResourcesState, getResource } from 'store/resources/resources';
 import { ContextMenuKind } from 'views-components/context-menu/context-menu';
 import { PermissionResource } from 'models/permission';
 import { Grid, Button, Tabs, Tab, Paper } from '@material-ui/core';
 import { AddIcon } from 'components/icon/icon';
+import { getUserUuid } from 'common/getuser';
+import { GroupResource } from 'models/group';
 
 export enum GroupDetailsPanelMembersColumnNames {
     FULL_NAME = "Name",
@@ -120,8 +122,13 @@ export const groupDetailsPermissionsPanelColumns: DataColumns<string> = [
 ];
 
 const mapStateToProps = (state: RootState) => {
+    const groupUuid = getCurrentGroupDetailsPanelUuid(state.properties);
+    const group = getResource<GroupResource>(groupUuid || '')(state.resources);
+    const userUuid = getUserUuid(state);
+
     return {
-        resources: state.resources
+        resources: state.resources,
+        groupCanManage: userUuid ? group?.writableBy?.includes(userUuid) : false,
     };
 };
 
@@ -134,6 +141,7 @@ export interface GroupDetailsPanelProps {
     onContextMenu: (event: React.MouseEvent<HTMLElement>, item: any) => void;
     onAddUser: () => void;
     resources: ResourcesState;
+    groupCanManage: boolean;
 }
 
 export const GroupDetailsPanel = connect(
@@ -166,14 +174,15 @@ export const GroupDetailsPanel = connect(
                           hideColumnSelector
                           hideSearchInput
                           actions={
-                              <Grid container justify='flex-end'>
-                                  <Button
+                                this.props.groupCanManage &&
+                                <Grid container justify='flex-end'>
+                                    <Button
                                       variant="contained"
                                       color="primary"
                                       onClick={this.props.onAddUser}>
                                       <AddIcon /> Add user
-                              </Button>
-                              </Grid>
+                                    </Button>
+                                </Grid>
                           }
                           paperProps={{
                               elevation: 0,

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list