Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login via Managed Identity token #1312

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 33 additions & 6 deletions src/components/routes/admin/users_add.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const useStyles = makeStyles(theme => ({
type User = {
avatar: string;
email: string;
identity_id: string;
groups: string[];
is_active: boolean;
type: string[];
Expand All @@ -54,6 +55,7 @@ type User = {
submission_quota: number;
api_daily_quota: number;
submission_daily_quota: number;
submission_async_quota: number;
roles?: string[];
};

Expand All @@ -73,13 +75,15 @@ const WrappedAddUserPage = () => {
type: ['user'],
classification: c12nDef.UNRESTRICTED,
email: '',
identity_id: '',
name: '',
new_pass: '',
uname: '',
api_quota: 10,
submission_quota: 5,
api_daily_quota: 0,
submission_daily_quota: 0
submission_daily_quota: 0,
submission_async_quota: 0
}),
[c12nDef.UNRESTRICTED]
);
Expand Down Expand Up @@ -160,7 +164,7 @@ const WrappedAddUserPage = () => {
<CloseOutlinedIcon />
</IconButton>
</div>
<div style={{ paddingLeft: theme.spacing(2), paddingRight: theme.spacing(2) }}>
<div style={{ paddingLeft: theme.spacing(2), paddingRight: theme.spacing(2), paddingBottom: theme.spacing(6) }}>
<Box mb={3}>
<Typography variant="h5">{t('newuser.title')}</Typography>
</Box>
Expand Down Expand Up @@ -218,7 +222,7 @@ const WrappedAddUserPage = () => {
onChange={(event, chips) => setNewUser(u => ({ ...u, groups: chips }))}
/>
</Grid>
<Grid item xs={12} md={6}>
<Grid item xs={12} md={4}>
<Typography variant="caption">{t('newuser.new_pass')}</Typography>
<TextField
fullWidth
Expand All @@ -230,7 +234,7 @@ const WrappedAddUserPage = () => {
value={newUser.new_pass}
/>
</Grid>
<Grid item xs={12} md={6}>
<Grid item xs={12} md={4}>
<Typography variant="caption">{t('newuser.email')}</Typography>
<TextField
fullWidth
Expand All @@ -241,6 +245,17 @@ const WrappedAddUserPage = () => {
value={newUser.email}
/>
</Grid>
<Grid item xs={12} md={4}>
<Typography variant="caption">{t('newuser.identity_id')}</Typography>
<TextField
fullWidth
size="small"
margin="dense"
variant="outlined"
onChange={event => setNewUser(u => ({ ...u, identity_id: event.target.value }))}
value={newUser.identity_id}
/>
</Grid>
<Grid item xs={12}>
<Typography variant="caption">{t('newuser.user_type')}</Typography>
<div>
Expand Down Expand Up @@ -281,7 +296,7 @@ const WrappedAddUserPage = () => {
value={String(newUser.api_daily_quota)}
/>
</Grid>
<Grid item xs={12} md={6}>
<Grid item xs={12} md={4}>
<Typography variant="caption">{t('newuser.submission_quota')}</Typography>
<TextField
fullWidth
Expand All @@ -293,7 +308,19 @@ const WrappedAddUserPage = () => {
value={String(newUser.submission_quota)}
/>
</Grid>
<Grid item xs={12} md={6}>
<Grid item xs={12} md={4}>
<Typography variant="caption">{t('newuser.submission_async_quota')}</Typography>
<TextField
fullWidth
type="number"
margin="dense"
size="small"
variant="outlined"
onChange={event => setNewUser(u => ({ ...u, submission_async_quota: parseNum(event) }))}
value={String(newUser.submission_async_quota)}
/>
</Grid>
<Grid item xs={12} md={4}>
<Typography variant="caption">{t('newuser.submission_daily_quota')}</Typography>
<TextField
fullWidth
Expand Down
10 changes: 10 additions & 0 deletions src/components/routes/user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,16 @@ function User({ username = null }: UserProps) {
</TableCell>
<TableCell align="right" />
</TableRow>
{currentUser.is_admin && (
<TableRow className={classes.row}>
{isXS ? null : <TableCell style={{ whiteSpace: 'nowrap' }}>{t('identity_id')}</TableCell>}
<TableCell width="100%">
{!isXS ? null : <Typography variant="caption">{t('identity_id')}</Typography>}
{user ? <div>{user.identity_id}</div> : <Skeleton />}
</TableCell>
<TableCell align="right" />
</TableRow>
)}
</TableBody>
</Table>
</TableContainer>
Expand Down
6 changes: 4 additions & 2 deletions src/locales/en/admin/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
"header.uid": "Username",
"newuser.api_daily_quota": "Daily API Quota",
"newuser.api_quota": "API Quota",
"newuser.email": "Email",
"newuser.email": "Email (optional)",
"newuser.identity_id": "Identity ID (optional)",
"newuser.groups": "Groups",
"newuser.name": "Full Name",
"newuser.new_pass": "Password",
"newuser.new_pass": "Password (optional)",
"newuser.save": "Add user",
"newuser.submission_async_quota": "Async Submission Quota",
"newuser.submission_daily_quota": "Daily Submission Quota",
"newuser.submission_quota": "Submission Quota",
"newuser.success": "New user was successfully added.",
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"done": "Done",
"email": "Email Address",
"enabled": "Account Enabled",
"identity_id": "Identity ID",
"groups": "Groups",
"groups_edit_title": "Groups are not for access control, they are used to group submissions of users of the same group together. When you submit a file, all groups you are member of are assigned to the submission.",
"name": "Full Name",
Expand Down
6 changes: 4 additions & 2 deletions src/locales/fr/admin/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
"header.uid": "Nom d'utilisateur",
"newuser.api_daily_quota": "Quota d'API quotidien",
"newuser.api_quota": "Quota d'API",
"newuser.email": "Email",
"newuser.email": "Email (Optionel)",
"newuser.identity_id": "ID d’identité (Optionel)",
"newuser.groups": "Groupes",
"newuser.name": "Nom complet",
"newuser.new_pass": "Mot de passe",
"newuser.new_pass": "Mot de passe (Optionel)",
"newuser.save": "Ajouter",
"newuser.submission_async_quota": "Quota de soumission asynchrone",
"newuser.submission_daily_quota": "Quota de soumission quotidien",
"newuser.submission_quota": "Quota de soumission",
"newuser.success": "Le nouvel utilisateur a été ajouté avec succès.",
Expand Down
1 change: 1 addition & 0 deletions src/locales/fr/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"done": "Terminé",
"email": "Adresse courriel",
"enabled": "Compte actif",
"identity_id": "ID d’identité",
"groups": "Groupes",
"groups_edit_title": "Les groupes ne sont pas destinés au contrôle d'accès, ils sont utilisés pour regrouper les soumissions des utilisateurs du même groupe. Lorsque vous soumettez un fichier, tous les groupes dont vous êtes membre sont affectés à la soumission.",
"name": "Nom complet",
Expand Down