Show the Authentik groups table as the Users and groups tab opens
Like the users, the groups are read on open instead of behind a Show groups button, for an Authentik that has the management token. If the read fails the button stays, as Try again. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
43d9ece8bc
commit
a15bbf1303
2 files changed
+11
-5
No files matched your search
+2
-2
@@ -526,11 +526,11 @@ osTicket's API cannot close a ticket, so this is the one place in the app that *
|
|||||||
The link is in the answer to that one request and nowhere else (not stored, not in the audit log); the audit log has *who made which user* and *who made a link for whom*, never the link or a token. If the user is made and the link is not (Authentik needs a **recovery flow** on the brand — System → Brands),
|
The link is in the answer to that one request and nowhere else (not stored, not in the audit log); the audit log has *who made which user* and *who made a link for whom*, never the link or a token. If the user is made and the link is not (Authentik needs a **recovery flow** on the brand — System → Brands),
|
||||||
the page says so and the link is made in Authentik (the user → *Create recovery link*). Authentik builds the link from the address it was called at, so the integration's address should be the one people use. The token for making users is only used for this; reading Authentik never uses it,
|
the page says so and the link is made in Authentik (the user → *Create recovery link*). Authentik builds the link from the address it was called at, so the integration's address should be the one people use. The token for making users is only used for this; reading Authentik never uses it,
|
||||||
and *Stop allowing this* on that tab removes it again (the reading token stays).
|
and *Stop allowing this* on that tab removes it again (the reading token stays).
|
||||||
**Users** on the same tab, read when the tab opens (the groups are read when *Show groups* is pressed), lists the people (service accounts — what an outpost or an integration signs in with — are left out), searchable, with whether each is on, whether they are an administrator and when they last signed in, and lets an administrator **edit a user's name, email and groups** (the user name is shown but not changeable: it is how a person is known elsewhere, and renaming could make them a new person here; Authentik is sent only what differs, as a `PATCH`, and groups as what goes in and what comes out on top of the groups the user has *now*, so a membership somebody gave them meanwhile is kept; a user whose groups Authentik does not say can be renamed but not moved between groups), **switch a user off** (a `PATCH` of `is_active` and nothing else;
|
**Users** on the same tab, read when the tab opens, lists the people (service accounts — what an outpost or an integration signs in with — are left out), searchable, with whether each is on, whether they are an administrator and when they last signed in, and lets an administrator **edit a user's name, email and groups** (the user name is shown but not changeable: it is how a person is known elsewhere, and renaming could make them a new person here; Authentik is sent only what differs, as a `PATCH`, and groups as what goes in and what comes out on top of the groups the user has *now*, so a membership somebody gave them meanwhile is kept; a user whose groups Authentik does not say can be renamed but not moved between groups), **switch a user off** (a `PATCH` of `is_active` and nothing else;
|
||||||
they can no longer sign in, nothing of theirs is lost, *Switch on* brings it back) or **delete** one (a `DELETE`, for good: the user name has to be typed, and is checked again by the server against the user as Authentik has them now). **Refused, by the server, with the reason:** a service account, the account the token
|
they can no longer sign in, nothing of theirs is lost, *Switch on* brings it back) or **delete** one (a `DELETE`, for good: the user name has to be typed, and is checked again by the server against the user as Authentik has them now). **Refused, by the server, with the reason:** a service account, the account the token
|
||||||
itself belongs to, and the last active administrator (so nobody can be locked out, or the sign-in in front of everything else cut off — for an edit, only when it would take them out of every group that makes them one); do those in Authentik. Each is in the audit log (*who edited — which fields, never their new values — switched off / on / deleted which user*). Switching off or deleting someone in Authentik does not end a session they
|
itself belongs to, and the last active administrator (so nobody can be locked out, or the sign-in in front of everything else cut off — for an edit, only when it would take them out of every group that makes them one); do those in Authentik. Each is in the audit log (*who edited — which fields, never their new values — switched off / on / deleted which user*). Switching off or deleting someone in Authentik does not end a session they
|
||||||
already have in this app: end it under Users → *Signed in now*. Lists are read 200 at a time.
|
already have in this app: end it under Users → *Signed in now*. Lists are read 200 at a time.
|
||||||
**Groups** on the same tab lists the groups with how many are in each and lets an administrator **make** one (a name and nothing else, a `POST /core/groups/` with `is_superuser` always false: it starts empty and is never a group that makes administrators; a name Authentik already has is its own refusal), **rename** one and **put users in and take them out** (a `PATCH` of `name` and nothing else; `POST /core/groups/{id}/add_user/` and `remove_user/`, one user each,
|
**Groups** on the same tab, also read when it opens, lists the groups with how many are in each and lets an administrator **make** one (a name and nothing else, a `POST /core/groups/` with `is_superuser` always false: it starts empty and is never a group that makes administrators; a name Authentik already has is its own refusal), **rename** one and **put users in and take them out** (a `PATCH` of `name` and nothing else; `POST /core/groups/{id}/add_user/` and `remove_user/`, one user each,
|
||||||
so somebody who joined meanwhile is never dropped by a whole list replacing the members). Everything asked is checked first and **nothing is changed unless all of it may be**: a service account, the token's own account, the last active administrator
|
so somebody who joined meanwhile is never dropped by a whole list replacing the members). Everything asked is checked first and **nothing is changed unless all of it may be**: a service account, the token's own account, the last active administrator
|
||||||
being taken out of the group that makes them one, and someone whose groups Authentik did not say (when taking them out of such a group) are refused with the reason. If Authentik fails part-way, the answer says how many of the changes had been made, and the audit log
|
being taken out of the group that makes them one, and someone whose groups Authentik did not say (when taking them out of such a group) are refused with the reason. If Authentik fails part-way, the answer says how many of the changes had been made, and the audit log
|
||||||
(*who renamed which group, who was put in and taken out*) has what was done. Whether a group **makes its members administrators of Authentik** is shown and is **not** changed or set from here, and groups are not deleted here. A group whose name is one of the
|
(*who renamed which group, who was put in and taken out*) has what was done. Whether a group **makes its members administrators of Authentik** is shown and is **not** changed or set from here, and groups are not deleted here. A group whose name is one of the
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useState, type FormEvent } from "react";
|
import { useEffect, useState, type FormEvent } from "react";
|
||||||
import { api, type AuthentikGroupDetail, type AuthentikGroupPerson, type AuthentikInfo } from "../api/client";
|
import { api, type AuthentikGroupDetail, type AuthentikGroupPerson, type AuthentikInfo } from "../api/client";
|
||||||
import { ErrorNotice, SuccessNotice } from "./Notice";
|
import { ErrorNotice, SuccessNotice } from "./Notice";
|
||||||
import { confirmDialog } from "../utils/dialogs";
|
import { confirmDialog } from "../utils/dialogs";
|
||||||
@@ -74,7 +74,7 @@ function EditGroup({ g, people, self, busy, onSave, onCancel }: { g: AuthentikGr
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The groups of an Authentik, for an administrator to make, rename and to put users in and take them out of. Whether a group makes its members administrators is shown, not changed — and a group
|
* The groups of an Authentik, read when the tab opens, for an administrator to make, rename and to put users in and take them out of. Whether a group makes its members administrators is shown, not changed — and a group
|
||||||
* made here never does. A group that
|
* made here never does. A group that
|
||||||
* decides somebody's role in this app says so, and asks before it is changed.
|
* decides somebody's role in this app says so, and asks before it is changed.
|
||||||
*/
|
*/
|
||||||
@@ -89,6 +89,12 @@ export default function AuthentikGroupList({ a }: { a: AuthentikInfo }) {
|
|||||||
const [creating, setCreating] = useState(false);
|
const [creating, setCreating] = useState(false);
|
||||||
const [newName, setNewName] = useState("");
|
const [newName, setNewName] = useState("");
|
||||||
|
|
||||||
|
// Read as the tab opens, like the users. If that fails, the button below tries again.
|
||||||
|
useEffect(() => {
|
||||||
|
if (a.canCreateUsers) void load();
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [a.id, a.canCreateUsers]);
|
||||||
|
|
||||||
if (!a.canCreateUsers) return null;
|
if (!a.canCreateUsers) return null;
|
||||||
|
|
||||||
async function create(e: FormEvent) {
|
async function create(e: FormEvent) {
|
||||||
@@ -181,7 +187,7 @@ export default function AuthentikGroupList({ a }: { a: AuthentikInfo }) {
|
|||||||
)}
|
)}
|
||||||
{groups === null ? (
|
{groups === null ? (
|
||||||
<button type="button" className="btn btn-sm btn-outline-secondary mb-2" onClick={() => void load()} disabled={busy !== null}>
|
<button type="button" className="btn btn-sm btn-outline-secondary mb-2" onClick={() => void load()} disabled={busy !== null}>
|
||||||
{busy === "list" ? "Reading…" : "Show groups"}
|
{busy === "list" ? "Reading…" : error ? "Try again" : "Show groups"}
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in new issue
Block a user