// SPDX-License-Identifier: AGPL-3.0
import { ContextMenuActionSet } from "views-components/context-menu/context-menu-action-set";
-import { AdvancedIcon, ProjectIcon, AttributesIcon } from "components/icon/icon";
+import {
+ AdvancedIcon,
+ ProjectIcon,
+ AttributesIcon,
+ DeactivateUserIcon,
+ UserPanelIcon,
+ LoginAsIcon,
+ AdminMenuIcon,
+ ActiveIcon,
+} from "components/icon/icon";
import { openAdvancedTabDialog } from 'store/advanced-tab/advanced-tab';
-import { openUserAttributes, openUserProjects } from "store/users/users-actions";
+import { loginAs, openUserAttributes, openUserProjects } from "store/users/users-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",
dispatch<any>(openUserProjects(uuid));
}
}, {
- name: "Advanced",
+ name: "API Details",
icon: AdvancedIcon,
execute: (dispatch, { uuid }) => {
dispatch<any>(openAdvancedTabDialog(uuid));
}
-}, /*
- // Neither of the buttons on this dialog work correctly (bugs #16114 and #16124) so hide it for now.
- {
- name: "Manage",
+}, {
+ name: "Account Settings",
icon: UserPanelIcon,
execute: (dispatch, { uuid }) => {
- dispatch<any>(openUserManagement(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,
+ ],
+}]];