web/admin: add set password button to user view page

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-05-22 16:46:38 +02:00
parent c99e6d8f2c
commit 8d49705c87
12 changed files with 62 additions and 17 deletions

View file

@ -4605,6 +4605,7 @@ msgstr ""
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Set password" msgid "Set password"
msgstr "Passwort festlegen" msgstr "Passwort festlegen"
@ -5922,6 +5923,8 @@ msgstr "Angaben aktualisieren"
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Update password" msgid "Update password"
msgstr "Passwort ändern" msgstr "Passwort ändern"

View file

@ -4693,6 +4693,7 @@ msgstr "Set custom attributes using YAML or JSON. Any attributes set here will b
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Set password" msgid "Set password"
msgstr "Set password" msgstr "Set password"
@ -6043,6 +6044,8 @@ msgstr "Update details"
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Update password" msgid "Update password"
msgstr "Update password" msgstr "Update password"

View file

@ -4598,6 +4598,7 @@ msgstr ""
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Set password" msgid "Set password"
msgstr "Establecer contraseña" msgstr "Establecer contraseña"
@ -5916,6 +5917,8 @@ msgstr "Detalles de actualización"
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Update password" msgid "Update password"
msgstr "Actualizar contraseña" msgstr "Actualizar contraseña"

View file

@ -4647,6 +4647,7 @@ msgstr ""
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Set password" msgid "Set password"
msgstr "" msgstr ""
@ -5974,6 +5975,8 @@ msgstr "Détails de la mise à jour"
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Update password" msgid "Update password"
msgstr "" msgstr ""

View file

@ -4595,6 +4595,7 @@ msgstr ""
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Set password" msgid "Set password"
msgstr "Ustaw hasło" msgstr "Ustaw hasło"
@ -5913,6 +5914,8 @@ msgstr "Zaktualizuj szczegóły"
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Update password" msgid "Update password"
msgstr "Zaktualizuj hasło" msgstr "Zaktualizuj hasło"

View file

@ -4673,6 +4673,7 @@ msgstr ""
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Set password" msgid "Set password"
msgstr "" msgstr ""
@ -6013,6 +6014,8 @@ msgstr ""
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Update password" msgid "Update password"
msgstr "" msgstr ""

View file

@ -4600,6 +4600,7 @@ msgstr ""
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Set password" msgid "Set password"
msgstr "Parola ayarla" msgstr "Parola ayarla"
@ -5918,6 +5919,8 @@ msgstr "Ayrıntıları güncelle"
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Update password" msgid "Update password"
msgstr "Parolayı güncelle" msgstr "Parolayı güncelle"

View file

@ -4563,6 +4563,7 @@ msgstr "使用 YAML 或 JSON 格式设置自定义属性。如果请求由此租
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Set password" msgid "Set password"
msgstr "设置密码" msgstr "设置密码"
@ -5878,6 +5879,8 @@ msgstr "更新详情"
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Update password" msgid "Update password"
msgstr "更新密码" msgstr "更新密码"

View file

@ -4568,6 +4568,7 @@ msgstr ""
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Set password" msgid "Set password"
msgstr "设置密码" msgstr "设置密码"
@ -5884,6 +5885,8 @@ msgstr "更新详情"
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Update password" msgid "Update password"
msgstr "更新密码" msgstr "更新密码"

View file

@ -4568,6 +4568,7 @@ msgstr ""
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Set password" msgid "Set password"
msgstr "设置密码" msgstr "设置密码"
@ -5884,6 +5885,8 @@ msgstr "更新详情"
#: src/pages/users/RelatedUserList.ts #: src/pages/users/RelatedUserList.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Update password" msgid "Update password"
msgstr "更新密码" msgstr "更新密码"

View file

@ -14,6 +14,7 @@ import { DEFAULT_CONFIG, config, tenant } from "../../api/Config";
import { me } from "../../api/Users"; import { me } from "../../api/Users";
import { uiConfig } from "../../common/config"; import { uiConfig } from "../../common/config";
import { PFColor } from "../../elements/Label"; import { PFColor } from "../../elements/Label";
import { PFSize } from "../../elements/Spinner";
import "../../elements/buttons/ActionButton"; import "../../elements/buttons/ActionButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm"; import "../../elements/forms/ModalForm";
@ -215,7 +216,7 @@ export class UserListPage extends TablePage<User> {
</dt> </dt>
<dd class="pf-c-description-list__description"> <dd class="pf-c-description-list__description">
<div class="pf-c-description-list__text"> <div class="pf-c-description-list__text">
<ak-forms-modal> <ak-forms-modal size=${PFSize.Medium}>
<span slot="submit">${t`Update password`}</span> <span slot="submit">${t`Update password`}</span>
<span slot="header">${t`Update password`}</span> <span slot="header">${t`Update password`}</span>
<ak-user-password-form <ak-user-password-form

View file

@ -23,6 +23,7 @@ import { EVENT_REFRESH } from "../../constants";
import "../../elements/CodeMirror"; import "../../elements/CodeMirror";
import { PFColor } from "../../elements/Label"; import { PFColor } from "../../elements/Label";
import "../../elements/PageHeader"; import "../../elements/PageHeader";
import { PFSize } from "../../elements/Spinner";
import "../../elements/Tabs"; import "../../elements/Tabs";
import "../../elements/buttons/ActionButton"; import "../../elements/buttons/ActionButton";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
@ -38,6 +39,7 @@ import "../../elements/user/UserConsentList";
import "../groups/RelatedGroupList"; import "../groups/RelatedGroupList";
import "./UserActiveForm"; import "./UserActiveForm";
import "./UserForm"; import "./UserForm";
import "./UserPasswordForm";
@customElement("ak-user-view") @customElement("ak-user-view")
export class UserViewPage extends LitElement { export class UserViewPage extends LitElement {
@ -195,6 +197,21 @@ export class UserViewPage extends LitElement {
</button> </button>
</ak-forms-modal> </ak-forms-modal>
</div> </div>
${until(
config().then((config) => {
if (config.capabilities.includes(CapabilitiesEnum.Impersonate)) {
return html` <div class="pf-c-card__footer">
<a
class="pf-c-button pf-m-tertiary"
href="${`/-/impersonation/${this.user?.pk}/`}"
>
${t`Impersonate`}
</a>
</div>`;
}
return html``;
}),
)}
<div class="pf-c-card__footer"> <div class="pf-c-card__footer">
<ak-user-active-form <ak-user-active-form
.obj=${this.user} .obj=${this.user}
@ -240,22 +257,19 @@ export class UserViewPage extends LitElement {
${t`Reset Password`} ${t`Reset Password`}
</ak-action-button> </ak-action-button>
</div> </div>
<div class="pf-c-card__footer">
${until( <ak-forms-modal size=${PFSize.Medium}>
config().then((config) => { <span slot="submit">${t`Update password`}</span>
if (config.capabilities.includes(CapabilitiesEnum.Impersonate)) { <span slot="header">${t`Update password`}</span>
return html` <div class="pf-c-card__footer"> <ak-user-password-form
<a slot="form"
class="pf-c-button pf-m-tertiary" .instancePk=${this.user?.pk}
href="${`/-/impersonation/${this.user?.pk}/`}" ></ak-user-password-form>
> <button slot="trigger" class="pf-c-button pf-m-secondary">
${t`Impersonate`} ${t`Set password`}
</a> </button>
</div>`; </ak-forms-modal>
} </div>
return html``;
}),
)}
</div> </div>
<div <div
class="pf-c-card pf-l-grid__item pf-m-12-col pf-m-9-col-on-xl pf-m-9-col-on-2xl" class="pf-c-card pf-l-grid__item pf-m-12-col pf-m-9-col-on-xl pf-m-9-col-on-2xl"