Merge remote-tracking branch 'origin/main' into 19051-handle-quotes-in-search
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / user-action-set.ts
index 0b2ff379b04928c817fbc769b4f89e7f98f9b103..c00b7f1f285c157bd95e2d2ef5e386a0e94fb7d8 100644 (file)
@@ -11,10 +11,13 @@ import {
     UserPanelIcon,
     LoginAsIcon,
     AdminMenuIcon,
+    ActiveIcon,
 } from "components/icon/icon";
 import { openAdvancedTabDialog } from 'store/advanced-tab/advanced-tab';
 import { loginAs, openUserAttributes, openUserProjects } from "store/users/users-actions";
-import { openSetupDialog, openDeactivateDialog } from "store/user-profile/user-profile-actions";
+import { openSetupDialog, openDeactivateDialog, openActivateDialog } from "store/user-profile/user-profile-actions";
+import { navigateToUserProfile } from "store/navigation/navigation-action";
+import { canActivateUser, canDeactivateUser, canSetupUser, isAdmin, needsUserProfileLink, isOtherUser } from "store/context-menu/context-menu-filters";
 
 export const userActionSet: ContextMenuActionSet = [[{
     name: "Attributes",
@@ -29,7 +32,7 @@ export const userActionSet: ContextMenuActionSet = [[{
         dispatch<any>(openUserProjects(uuid));
     }
 }, {
-    name: "Advanced",
+    name: "API Details",
     icon: AdvancedIcon,
     execute: (dispatch, { uuid }) => {
         dispatch<any>(openAdvancedTabDialog(uuid));
@@ -38,26 +41,47 @@ export const userActionSet: ContextMenuActionSet = [[{
     name: "Account Settings",
     icon: UserPanelIcon,
     execute: (dispatch, { uuid }) => {
-        dispatch<any>(openAdvancedTabDialog(uuid));
-    }
+        dispatch<any>(navigateToUserProfile(uuid));
+    },
+    filters: [needsUserProfileLink]
+}],[{
+    name: "Activate User",
+    icon: ActiveIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openActivateDialog(uuid));
+    },
+    filters: [
+        isAdmin,
+        canActivateUser,
+    ],
 }, {
     name: "Setup User",
     icon: AdminMenuIcon,
     execute: (dispatch, { uuid }) => {
         dispatch<any>(openSetupDialog(uuid));
-    }
+    },
+    filters: [
+        isAdmin,
+        canSetupUser,
+    ],
 }, {
     name: "Deactivate User",
     icon: DeactivateUserIcon,
     execute: (dispatch, { uuid }) => {
         dispatch<any>(openDeactivateDialog(uuid));
-    }
+    },
+    filters: [
+        isAdmin,
+        canDeactivateUser,
+    ],
 }, {
     name: "Login As User",
     icon: LoginAsIcon,
     execute: (dispatch, { uuid }) => {
         dispatch<any>(loginAs(uuid));
-    }
-},
-
-]];
+    },
+    filters: [
+        isAdmin,
+        isOtherUser,
+    ],
+}]];