From e4290adf930f1349f9d63df3e8612ecedee9beff Mon Sep 17 00:00:00 2001 From: Steve Garon Date: Wed, 27 Nov 2024 21:29:07 +0000 Subject: [PATCH 1/3] Allow submission async quota and identity_id to be set while adding users --- src/components/routes/admin/users_add.tsx | 39 +++++++++++++++++++---- src/locales/en/admin/users.json | 6 ++-- src/locales/fr/admin/users.json | 6 ++-- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/components/routes/admin/users_add.tsx b/src/components/routes/admin/users_add.tsx index 070ae8625..944ba510a 100644 --- a/src/components/routes/admin/users_add.tsx +++ b/src/components/routes/admin/users_add.tsx @@ -43,6 +43,7 @@ const useStyles = makeStyles(theme => ({ type User = { avatar: string; email: string; + identity_id: string; groups: string[]; is_active: boolean; type: string[]; @@ -54,6 +55,7 @@ type User = { submission_quota: number; api_daily_quota: number; submission_daily_quota: number; + submission_async_quota: number; roles?: string[]; }; @@ -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] ); @@ -160,7 +164,7 @@ const WrappedAddUserPage = () => { -
+
{t('newuser.title')} @@ -218,7 +222,7 @@ const WrappedAddUserPage = () => { onChange={(event, chips) => setNewUser(u => ({ ...u, groups: chips }))} /> - + {t('newuser.new_pass')} { value={newUser.new_pass} /> - + {t('newuser.email')} { value={newUser.email} /> + + {t('newuser.identity_id')} + setNewUser(u => ({ ...u, identity_id: event.target.value }))} + value={newUser.identity_id} + /> + {t('newuser.user_type')}
@@ -281,7 +296,7 @@ const WrappedAddUserPage = () => { value={String(newUser.api_daily_quota)} /> - + {t('newuser.submission_quota')} { value={String(newUser.submission_quota)} /> - + + {t('newuser.submission_async_quota')} + setNewUser(u => ({ ...u, submission_async_quota: parseNum(event) }))} + value={String(newUser.submission_async_quota)} + /> + + {t('newuser.submission_daily_quota')} Date: Wed, 27 Nov 2024 21:34:32 +0000 Subject: [PATCH 2/3] Show identity id in the user profile --- src/components/routes/user.tsx | 8 ++++++++ src/locales/en/user.json | 1 + src/locales/fr/user.json | 1 + 3 files changed, 10 insertions(+) diff --git a/src/components/routes/user.tsx b/src/components/routes/user.tsx index e2543883f..05c40a2b5 100644 --- a/src/components/routes/user.tsx +++ b/src/components/routes/user.tsx @@ -675,6 +675,14 @@ function User({ username = null }: UserProps) { + + {isXS ? null : {t('identity_id')}} + + {!isXS ? null : {t('identity_id')}} + {user ?
{user.identity_id}
: } +
+ +
diff --git a/src/locales/en/user.json b/src/locales/en/user.json index 6b48a6ab4..67ec573c2 100644 --- a/src/locales/en/user.json +++ b/src/locales/en/user.json @@ -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", diff --git a/src/locales/fr/user.json b/src/locales/fr/user.json index c699c8a26..87e736730 100644 --- a/src/locales/fr/user.json +++ b/src/locales/fr/user.json @@ -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", From 3127aa56313e387edb0297eb6c2e2e3e6742d3f2 Mon Sep 17 00:00:00 2001 From: Steve Garon Date: Wed, 27 Nov 2024 21:47:16 +0000 Subject: [PATCH 3/3] Only show the identity id to admin users --- src/components/routes/user.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/routes/user.tsx b/src/components/routes/user.tsx index 05c40a2b5..68af73044 100644 --- a/src/components/routes/user.tsx +++ b/src/components/routes/user.tsx @@ -675,14 +675,16 @@ function User({ username = null }: UserProps) {
- - {isXS ? null : {t('identity_id')}} - - {!isXS ? null : {t('identity_id')}} - {user ?
{user.identity_id}
: } -
- -
+ {currentUser.is_admin && ( + + {isXS ? null : {t('identity_id')}} + + {!isXS ? null : {t('identity_id')}} + {user ?
{user.identity_id}
: } +
+ +
+ )}