web/admin: small fixes (#7292)
* show user type better on admin interface Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix rendering for backchannel in app form Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix missing trailing slash in admin redirect Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -121,7 +121,7 @@ export class AdminInterface extends Interface {
|
||||
// TODO: somehow add `access_admin_interface` to the API schema
|
||||
this.user.user.systemPermissions.includes("access_admin_interface");
|
||||
if (!canAccessAdmin && this.user.user.pk > 0) {
|
||||
window.location.assign("/if/user");
|
||||
window.location.assign("/if/user/");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ export class AkBackchannelProvidersInput extends AKElement {
|
||||
<div class="pf-c-input-group">
|
||||
<ak-provider-select-table ?backchannelOnly=${true} .confirm=${confirm}>
|
||||
<button slot="trigger" class="pf-c-button pf-m-control" type="button">
|
||||
$ {this.tooltip ? this.tooltip : nothing }
|
||||
${this.tooltip ? this.tooltip : nothing}
|
||||
<i class="fas fa-plus" aria-hidden="true"></i>
|
||||
</button>
|
||||
</ak-provider-select-table>
|
||||
|
@ -6,6 +6,7 @@ import "@goauthentik/admin/users/UserPasswordForm";
|
||||
import "@goauthentik/admin/users/UserResetEmailForm";
|
||||
import { me } from "@goauthentik/app/common/users";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { userTypeToLabel } from "@goauthentik/common/labels";
|
||||
import { MessageLevel } from "@goauthentik/common/messages";
|
||||
import { DefaultUIConfig, uiConfig } from "@goauthentik/common/ui/config";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
@ -247,9 +248,9 @@ export class UserListPage extends TablePage<User> {
|
||||
item.pk !== this.me?.user.pk;
|
||||
return [
|
||||
html`<a href="#/identity/users/${item.pk}">
|
||||
<div>${item.username}</div>
|
||||
<small>${item.name}</small>
|
||||
</a>`,
|
||||
<div>${item.username}</div>
|
||||
<small>${item.name === "" ? msg("<No name set>") : item.name}</small> </a
|
||||
> <small>${userTypeToLabel(item.type)}</small>`,
|
||||
html`<ak-label color=${item.isActive ? PFColor.Green : PFColor.Red}>
|
||||
${item.isActive ? msg("Yes") : msg("No")}
|
||||
</ak-label>`,
|
||||
|
@ -13,6 +13,7 @@ import { me } from "@goauthentik/app/common/users";
|
||||
import "@goauthentik/app/elements/rbac/ObjectPermissionsPage";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { EVENT_REFRESH } from "@goauthentik/common/constants";
|
||||
import { userTypeToLabel } from "@goauthentik/common/labels";
|
||||
import "@goauthentik/components/events/ObjectChangelog";
|
||||
import "@goauthentik/components/events/UserEvents";
|
||||
import { AKElement, rootInterface } from "@goauthentik/elements/Base";
|
||||
@ -188,6 +189,16 @@ export class UserViewPage extends AKElement {
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${msg("Type")}</span>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
${userTypeToLabel(user.type)}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${msg("Superuser")}</span>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { msg } from "@lit/localize";
|
||||
|
||||
import { Device, EventActions, IntentEnum, SeverityEnum } from "@goauthentik/api";
|
||||
import { Device, EventActions, IntentEnum, SeverityEnum, UserTypeEnum } from "@goauthentik/api";
|
||||
|
||||
/* Various tables in the API for which we need to supply labels */
|
||||
|
||||
@ -65,3 +65,13 @@ export const deviceTypeToLabel = new Map<string, string>([
|
||||
|
||||
export const deviceTypeName = (device: Device) =>
|
||||
deviceTypeToLabel.get(device.type) ?? device?.verboseName ?? "";
|
||||
|
||||
const _userTypeToLabel = new Map<UserTypeEnum | undefined, string>([
|
||||
[UserTypeEnum.Internal, msg("Internal")],
|
||||
[UserTypeEnum.External, msg("External")],
|
||||
[UserTypeEnum.ServiceAccount, msg("Service account")],
|
||||
[UserTypeEnum.InternalServiceAccount, msg("Service account (internal)")],
|
||||
]);
|
||||
|
||||
export const userTypeToLabel = (type?: UserTypeEnum): string =>
|
||||
_userTypeToLabel.get(type) ?? type ?? "";
|
||||
|
Reference in New Issue
Block a user