register allow change password condition
This commit is contained in:
@@ -14,6 +14,11 @@ export const manifests: Array<ManifestTypes | UmbBackofficeManifestKind> = [
|
||||
icon: 'icon-key',
|
||||
label: '#user_changePassword',
|
||||
},
|
||||
conditions: [
|
||||
{
|
||||
alias: 'Umb.Condition.User.AllowChangePassword',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'modal',
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
export const manifests: Array<ManifestTypes> = [
|
||||
{
|
||||
type: 'condition',
|
||||
name: 'User Allow Change Password Condition',
|
||||
alias: 'Umb.Condition.User.AllowChangePassword',
|
||||
api: () => import('./user-allow-change-password-action.condition.js'),
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,15 @@
|
||||
import { UmbUserModelKind } from '../../utils/index.js';
|
||||
import { UmbUserActionConditionBase } from '../user-allow-action-base.condition.js';
|
||||
|
||||
export class UmbUserAllowChangePasswordActionCondition extends UmbUserActionConditionBase {
|
||||
async _onUserDataChange() {
|
||||
// don't allow the current user to delete themselves
|
||||
if (this.userKind === UmbUserModelKind.DEFAULT) {
|
||||
this.permitted = true;
|
||||
} else {
|
||||
this.permitted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { UmbUserAllowChangePasswordActionCondition as api };
|
||||
@@ -1,3 +1,4 @@
|
||||
import { manifests as userAllowChangePasswordActionManifests } from './allow-change-password/manifests.js';
|
||||
import { manifests as userAllowDeleteActionManifests } from './allow-delete/manifests.js';
|
||||
import { manifests as userAllowDisableActionManifests } from './allow-disable/manifests.js';
|
||||
import { manifests as userAllowEnableActionManifests } from './allow-enable/manifests.js';
|
||||
@@ -7,10 +8,11 @@ import { manifests as userAllowUnlockActionManifests } from './allow-unlock/mani
|
||||
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
export const manifests: Array<ManifestTypes> = [
|
||||
...userAllowChangePasswordActionManifests,
|
||||
...userAllowDeleteActionManifests,
|
||||
...userAllowDisableActionManifests,
|
||||
...userAllowEnableActionManifests,
|
||||
...userAllowUnlockActionManifests,
|
||||
...userAllowExternalLoginActionManifests,
|
||||
...userAllowMfaActionManifests,
|
||||
...userAllowDeleteActionManifests,
|
||||
...userAllowUnlockActionManifests,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user