// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 import React from "react"; import { compose, Dispatch } from "redux"; import { connect } from "react-redux"; import { Dialog, DialogTitle, DialogContent, DialogActions, Button, Typography } from "@material-ui/core"; import { WithDialogProps } from "store/dialog/with-dialog"; import { withDialog } from 'store/dialog/with-dialog'; import { WithStyles, withStyles } from '@material-ui/core/styles'; import { ArvadosTheme } from 'common/custom-theme'; import { USER_MANAGEMENT_DIALOG, openSetupShellAccount, loginAs } from "store/users/users-actions"; import { getUserDisplayName } from "models/user"; type CssRules = 'spacing'; const styles = withStyles((theme: ArvadosTheme) => ({ spacing: { paddingBottom: theme.spacing.unit * 2, paddingTop: theme.spacing.unit * 2, } })); interface UserManageDataProps { data: any; } interface UserManageActionProps { openSetupShellAccount: (uuid: string) => void; loginAs: (uuid: string) => void; } const mapDispatchToProps = (dispatch: Dispatch) => ({ openSetupShellAccount: (uuid: string) => dispatch(openSetupShellAccount(uuid)), loginAs: (uuid: string) => dispatch(loginAs(uuid)) }); type UserManageProps = UserManageDataProps & UserManageActionProps & WithStyles; export const UserManageDialog = compose( connect(null, mapDispatchToProps), withDialog(USER_MANAGEMENT_DIALOG), styles)( (props: WithDialogProps & UserManageProps) => {props.data && {`Manage - ${getUserDisplayName(props.data)}`} 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. As an admin, you can setup a shell account for this user. The login name is automatically generated from the user's e-mail address. } );