import LinkOutlined from '@material-ui/icons/LinkOutlined';
import RemoveRedEye from '@material-ui/icons/RemoveRedEye';
import Computer from '@material-ui/icons/Computer';
+import CropFreeSharp from '@material-ui/icons/CropFreeSharp';
+import Cancel from '@material-ui/icons/Cancel';
+import ExitToApp from '@material-ui/icons/ExitToApp';
// Import FontAwesome icons
import { library } from '@fortawesome/fontawesome-svg-core';
import { faPencilAlt, faSlash, faUsers, faEllipsisH } from '@fortawesome/free-solid-svg-icons';
-import { CropFreeSharp } from '@material-ui/icons';
library.add(
faPencilAlt,
faSlash,
export const CanWriteIcon: IconType = (props) => <Edit {...props} />;
export const CanManageIcon: IconType = (props) => <Computer {...props} />;
export const AddUserIcon: IconType = (props) => <PersonAdd {...props} />;
+export const DeactivateUserIcon: IconType = (props) => <Cancel {...props} />;
+export const LoginAsIcon: IconType = (props) => <ExitToApp {...props} />;
}));
}
-
export const setup = (uuid: string) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
try {
// 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,
+} 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 } from "store/user-profile/user-profile-actions";
export const userActionSet: ContextMenuActionSet = [[{
name: "Attributes",
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>(openAdvancedTabDialog(uuid));
+ }
+}, {
+ name: "Setup User",
+ icon: AdminMenuIcon,
+ execute: (dispatch, { uuid }) => {
+ dispatch<any>(openSetupDialog(uuid));
+ }
+}, {
+ name: "Deactivate User",
+ icon: DeactivateUserIcon,
+ execute: (dispatch, { uuid }) => {
+ dispatch<any>(openDeactivateDialog(uuid));
+ }
+}, {
+ name: "Login As User",
+ icon: LoginAsIcon,
+ execute: (dispatch, { uuid }) => {
+ dispatch<any>(loginAs(uuid));
}
-} */
+},
+
]];
StyleRulesCallback,
WithStyles,
withStyles,
- Card,
CardContent,
Button,
Typography,
});
export interface UserProfilePanelRootActionProps {
- openSetupDialog: (uuid: string) => void;
- loginAs: (uuid: string) => void;
- openDeactivateDialog: (uuid: string) => void;
handleContextMenu: (event, resource: UserResource) => void;
}
enum TABS {
PROFILE = "PROFILE",
GROUPS = "GROUPS",
- ADMIN = "ADMIN",
}
<Tabs value={this.state.value} onChange={this.handleChange} variant={"fullWidth"}>
<Tab label={TABS.PROFILE} value={TABS.PROFILE} />
<Tab label={TABS.GROUPS} value={TABS.GROUPS} />
- {this.props.isAdmin && <Tab label={TABS.ADMIN} value={TABS.ADMIN} />}
</Tabs>
{this.state.value === TABS.PROFILE &&
<CardContent>
messages={['Group list is empty.']} />
} />
</div>}
- {this.props.isAdmin && this.state.value === TABS.ADMIN &&
- <Paper elevation={0} className={this.props.classes.adminRoot}>
- <Card elevation={0}>
- <CardContent>
- <Grid container
- direction="row"
- justify={'flex-end'}
- alignItems={'center'}>
- <Grid item xs>
- <Typography variant="h6" className={this.props.classes.title}>
- Setup Account
- </Typography>
- <Typography variant="body1" className={this.props.classes.description}>
- This button sets up a user. After setup, they will be able use Arvados. This dialog box also allows you to optionally set up a shell account for this user. The login name is automatically generated from the user's e-mail address.
- </Typography>
- </Grid>
- <Grid item sm={'auto'} xs={12}>
- <Button variant="contained"
- color="primary"
- onClick={() => {this.props.openSetupDialog(this.props.userUuid)}}
- disabled={false}>
- Setup Account
- </Button>
- </Grid>
- </Grid>
- </CardContent>
- </Card>
- <Card elevation={0}>
- <CardContent>
- <Grid container
- direction="row"
- justify={'flex-end'}
- alignItems={'center'}>
- <Grid item xs>
- <Typography variant="h6" className={this.props.classes.title}>
- Deactivate
- </Typography>
- <Typography variant="body1" className={this.props.classes.description}>
- As an admin, you can deactivate and reset this user. This will remove all repository/VM permissions for the user. If you "setup" the user again, the user will have to sign the user agreement again. You may also want to reassign data ownership.
- </Typography>
- </Grid>
- <Grid item sm={'auto'} xs={12}>
- <Button variant="contained"
- color="primary"
- onClick={() => {this.props.openDeactivateDialog(this.props.userUuid)}}
- disabled={false}>
- Deactivate
- </Button>
- </Grid>
- </Grid>
- </CardContent>
- </Card>
- <Card elevation={0}>
- <CardContent>
- <Grid container
- direction="row"
- justify={'flex-end'}
- alignItems={'center'}>
- <Grid item xs>
- <Typography variant="h6" className={this.props.classes.title}>
- Log In
- </Typography>
- <Typography variant="body1" className={this.props.classes.description}>
- As an admin, you can log in as this user. When you’ve finished, you will need to log out and log in again with your own account.
- </Typography>
- </Grid>
- <Grid item sm={'auto'} xs={12}>
- <Button variant="contained"
- color="primary"
- onClick={() => {this.props.loginAs(this.props.userUuid)}}
- disabled={false}>
- Log In
- </Button>
- </Grid>
- </Grid>
- </CardContent>
- </Card>
- </Paper>}
</Paper >;
}
import { UserResource } from 'models/user';
import { saveEditedUser } from 'store/user-profile/user-profile-actions';
import { UserProfilePanelRoot, UserProfilePanelRootDataProps } from 'views/user-profile-panel/user-profile-panel-root';
-import { openSetupDialog, openDeactivateDialog, USER_PROFILE_FORM } from "store/user-profile/user-profile-actions";
+import { USER_PROFILE_FORM } from "store/user-profile/user-profile-actions";
import { matchUserProfileRoute } from 'routes/routes';
-import { loginAs } from 'store/users/users-actions';
import { openUserContextMenu } from 'store/context-menu/context-menu-actions';
const mapStateToProps = (state: RootState): UserProfilePanelRootDataProps => {
}};
const mapDispatchToProps = (dispatch: Dispatch) => ({
- openSetupDialog: (uuid: string) => dispatch<any>(openSetupDialog(uuid)),
- loginAs: (uuid: string) => dispatch<any>(loginAs(uuid)),
- openDeactivateDialog: (uuid: string) => dispatch<any>(openDeactivateDialog(uuid)),
handleContextMenu: (event, resource: UserResource) => dispatch<any>(openUserContextMenu(event, resource)),
});