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

feat: Recommend setting groups after user creation #1043

Merged
Merged
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
2 changes: 2 additions & 0 deletions frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@
"successfullyRejectedObject": "The {object} object has been successfully rejected",
"successfullyRevokedObject": "The {object} object has been successfully revoked",
"successfullyImportedObject": "The {object} object has been successfully imported",
"userHasNoRights": ". This user has no rights, remember to edit their user groups",
"createdUserWillHaveNoRights": "This user will have no rights after creation; remember to edit their user groups",
"anErrorOccurred": "An error has occurred",
"attachmentDeleted": "The attachment has been successfully deleted",
"librarySuccessfullyLoaded": "The library has been successfully loaded",
Expand Down
2 changes: 2 additions & 0 deletions frontend/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@
"successfullyRejectedObject": "L'objet {object} a été rejeté avec succès",
"successfullyRevokedObject": "L'objet {object} a été révoqué avec succès",
"successfullyImportedObject": "L'objet {object} a été importé avec succès",
"userHasNoRights": ". Il n'a aucune permissions, pensez à éditer ses groupes utilisateurs",
"createdUserWillHaveNoRights": "Cet utilisateur n'aura aucune permission, pensez à éditer ses groupes utilisateurs après sa création",
"anErrorOccurred": "Une erreur est survenue",
"attachmentDeleted": "La pièce jointe a été supprimée avec succès",
"librarySuccessfullyLoaded": "La bibliothèque a été chargée avec succès",
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/lib/components/Forms/ModelForm/UserForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@
{#if shape.is_active}
<Checkbox {form} field="is_active" label={m.isActive()} helpText={m.isActiveHelpText()} />
{/if}
<span class="text-gray-500 pt-5">
⚠️ {m.createdUserWillHaveNoRights()}
</span>
17 changes: 10 additions & 7 deletions frontend/src/lib/utils/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,15 @@ export async function defaultWriteFormAction({
}
}

setFlash(
{
type: 'success',
message: getSuccessMessage({ urlModel, action }) as string
},
event
);
let flashParams = {
type: 'success',
message: getSuccessMessage({ urlModel, action }) as string
};

if (urlModel == 'users') {
(flashParams.type = 'warning'), (flashParams.message += safeTranslate('userHasNoRights'));
}
setFlash(flashParams, event);

const next = getSecureRedirect(event.url.searchParams.get('next'));
if (next && doRedirect) redirect(302, next);
Expand All @@ -171,6 +173,7 @@ export async function nestedWriteFormAction({
redirectToWrittenObject = false
}: {
event: RequestEvent;

action: FormAction;
redirectToWrittenObject: boolean;
}) {
Expand Down
Loading