@umbraco-cms/backoffice 15.2.0-rc → 15.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cms/assets/lang/da-dk.js +3 -1
- package/dist-cms/assets/lang/da-dk.ts +3 -1
- package/dist-cms/assets/lang/en-us.js +0 -1
- package/dist-cms/assets/lang/en-us.ts +0 -1
- package/dist-cms/assets/lang/en.js +3 -1
- package/dist-cms/assets/lang/en.ts +3 -1
- package/dist-cms/external/backend-api/src/types.gen.d.ts +2 -0
- package/dist-cms/libs/localization-api/localization.controller.d.ts +2 -1
- package/dist-cms/libs/localization-api/localization.controller.js +3 -3
- package/dist-cms/packages/clipboard/clipboard-entry/detail/manifests.js +5 -1
- package/dist-cms/packages/core/entity-action/common/delete/delete.action.d.ts +1 -0
- package/dist-cms/packages/core/entity-action/common/delete/delete.action.js +7 -3
- package/dist-cms/packages/core/entity-action/common/delete/types.d.ts +4 -0
- package/dist-cms/packages/user/change-password/entity-action/manifests.js +2 -2
- package/dist-cms/packages/user/current-user/mfa-login/manifests.js +2 -1
- package/dist-cms/packages/user/current-user/profile/manifests.js +2 -1
- package/dist-cms/packages/user/user/conditions/allow-change-password/constants.d.ts +1 -0
- package/dist-cms/packages/user/user/conditions/allow-change-password/constants.js +1 -0
- package/dist-cms/packages/user/user/conditions/allow-change-password/current-user-allow-change-password-action.condition.d.ts +8 -0
- package/dist-cms/packages/user/user/conditions/allow-change-password/current-user-allow-change-password-action.condition.js +17 -0
- package/dist-cms/packages/user/user/conditions/allow-change-password/manifests.js +7 -1
- package/dist-cms/packages/user/user/conditions/allow-mfa/constants.d.ts +1 -0
- package/dist-cms/packages/user/user/conditions/allow-mfa/constants.js +1 -0
- package/dist-cms/packages/user/user/conditions/allow-mfa/current-user-allow-mfa-action.condition.d.ts +7 -0
- package/dist-cms/packages/user/user/conditions/allow-mfa/current-user-allow-mfa-action.condition.js +21 -0
- package/dist-cms/packages/user/user/conditions/allow-mfa/manifests.js +7 -1
- package/dist-cms/packages/user/user/entity-actions/manifests.js +2 -2
- package/dist-cms/packages/user/user/repository/config/constants.d.ts +3 -0
- package/dist-cms/packages/user/user/repository/config/constants.js +3 -0
- package/dist-cms/packages/user/user/repository/config/current-user-config.repository.d.ts +24 -0
- package/dist-cms/packages/user/user/repository/config/current-user-config.repository.js +47 -0
- package/dist-cms/packages/user/user/repository/config/current-user-config.server.data-source.d.ts +10 -0
- package/dist-cms/packages/user/user/repository/config/current-user-config.server.data-source.js +15 -0
- package/dist-cms/packages/user/user/repository/config/current-user-config.store.d.ts +7 -0
- package/dist-cms/packages/user/user/repository/config/current-user-config.store.js +8 -0
- package/dist-cms/packages/user/user/repository/config/current-user-config.store.token.d.ts +3 -0
- package/dist-cms/packages/user/user/repository/config/current-user-config.store.token.js +2 -0
- package/dist-cms/packages/user/user/repository/config/index.d.ts +1 -0
- package/dist-cms/packages/user/user/repository/config/index.js +1 -0
- package/dist-cms/packages/user/user/repository/config/manifests.js +13 -1
- package/dist-cms/packages/user/user/repository/config/user-config.server.data-source.d.ts +5 -0
- package/dist-cms/packages/user/user/repository/config/user-config.server.data-source.js +7 -0
- package/dist-cms/packages/user/user/types.d.ts +2 -1
- package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
- package/dist-cms/umbraco-package-schema.json +17 -6
- package/dist-cms/umbraco-package.json +1 -1
- package/package.json +1 -1
|
@@ -439,7 +439,7 @@ export default {
|
|
|
439
439
|
anchorLinkPicker: 'Lokalt link / querystreng',
|
|
440
440
|
anchorInsert: 'Navn på lokalt link',
|
|
441
441
|
closeThisWindow: 'Luk denne dialog',
|
|
442
|
-
confirmdelete:
|
|
442
|
+
confirmdelete: (name) => `Er du sikker på at du vil slette${name ? ` <strong>${name}</strong>` : ''}?`,
|
|
443
443
|
confirmdisable: 'Er du sikker på du vil deaktivere',
|
|
444
444
|
confirmremove: 'Er du sikker på at du vil fjerne',
|
|
445
445
|
confirmremoveusageof: 'Er du sikker på du vil fjerne brugen af <strong>%0%</strong>',
|
|
@@ -2095,6 +2095,8 @@ export default {
|
|
|
2095
2095
|
labelForRemoveAllEntries: 'Fjern alle elementer',
|
|
2096
2096
|
labelForClearClipboard: 'Ryd udklipsholder',
|
|
2097
2097
|
labelForCopyToClipboard: 'Kopier til udklipsholder',
|
|
2098
|
+
confirmDeleteHeadline: 'Slet fra udklipsholderen',
|
|
2099
|
+
confirmDeleteDescription: 'Er du sikker på at du vil slette <strong>{0}</strong> fra udklipsholderen?',
|
|
2098
2100
|
},
|
|
2099
2101
|
propertyActions: {
|
|
2100
2102
|
tooltipForPropertyActionsMenu: 'Åben egenskabshandlinger',
|
|
@@ -478,7 +478,7 @@ export default {
|
|
|
478
478
|
anchorLinkPicker: 'Lokalt link / querystreng',
|
|
479
479
|
anchorInsert: 'Navn på lokalt link',
|
|
480
480
|
closeThisWindow: 'Luk denne dialog',
|
|
481
|
-
confirmdelete:
|
|
481
|
+
confirmdelete: (name: string) => `Er du sikker på at du vil slette${name ? ` <strong>${name}</strong>` : ''}?`,
|
|
482
482
|
confirmdisable: 'Er du sikker på du vil deaktivere',
|
|
483
483
|
confirmremove: 'Er du sikker på at du vil fjerne',
|
|
484
484
|
confirmremoveusageof: 'Er du sikker på du vil fjerne brugen af <strong>%0%</strong>',
|
|
@@ -2249,6 +2249,8 @@ export default {
|
|
|
2249
2249
|
labelForRemoveAllEntries: 'Fjern alle elementer',
|
|
2250
2250
|
labelForClearClipboard: 'Ryd udklipsholder',
|
|
2251
2251
|
labelForCopyToClipboard: 'Kopier til udklipsholder',
|
|
2252
|
+
confirmDeleteHeadline: 'Slet fra udklipsholderen',
|
|
2253
|
+
confirmDeleteDescription: 'Er du sikker på at du vil slette <strong>{0}</strong> fra udklipsholderen?',
|
|
2252
2254
|
},
|
|
2253
2255
|
propertyActions: {
|
|
2254
2256
|
tooltipForPropertyActionsMenu: 'Åben egenskabshandlinger',
|
|
@@ -469,7 +469,6 @@ export default {
|
|
|
469
469
|
anchorLinkPicker: 'Anchor or querystring',
|
|
470
470
|
anchorInsert: 'Name',
|
|
471
471
|
closeThisWindow: 'Close this window',
|
|
472
|
-
confirmdelete: 'Are you sure you want to delete',
|
|
473
472
|
confirmdeleteNumberOfItems: 'Are you sure you want to delete <strong>%0%</strong> of <strong>%1%</strong> items',
|
|
474
473
|
confirmdisable: 'Are you sure you want to disable',
|
|
475
474
|
confirmremove: 'Are you sure you want to remove',
|
|
@@ -508,7 +508,6 @@ export default {
|
|
|
508
508
|
anchorLinkPicker: 'Anchor or querystring',
|
|
509
509
|
anchorInsert: 'Name',
|
|
510
510
|
closeThisWindow: 'Close this window',
|
|
511
|
-
confirmdelete: 'Are you sure you want to delete',
|
|
512
511
|
confirmdeleteNumberOfItems: 'Are you sure you want to delete <strong>%0%</strong> of <strong>%1%</strong> items',
|
|
513
512
|
confirmdisable: 'Are you sure you want to disable',
|
|
514
513
|
confirmremove: 'Are you sure you want to remove',
|
|
@@ -457,7 +457,7 @@ export default {
|
|
|
457
457
|
anchorLinkPicker: 'Anchor or querystring',
|
|
458
458
|
anchorInsert: 'Name',
|
|
459
459
|
closeThisWindow: 'Close this window',
|
|
460
|
-
confirmdelete:
|
|
460
|
+
confirmdelete: (name) => `Are you sure you want to delete${name ? ` <strong>${name}</strong>` : ''}?`,
|
|
461
461
|
confirmdeleteNumberOfItems: 'Are you sure you want to delete <strong>%0%</strong> of <strong>%1%</strong> items',
|
|
462
462
|
confirmdisable: 'Are you sure you want to disable',
|
|
463
463
|
confirmremove: 'Are you sure you want to remove',
|
|
@@ -2210,6 +2210,8 @@ export default {
|
|
|
2210
2210
|
labelForRemoveAllEntries: 'Remove all items',
|
|
2211
2211
|
labelForClearClipboard: 'Clear clipboard',
|
|
2212
2212
|
labelForCopyToClipboard: 'Copy to clipboard',
|
|
2213
|
+
confirmDeleteHeadline: 'Delete from clipboard',
|
|
2214
|
+
confirmDeleteDescription: 'Are you sure you want to delete <strong>{0}</strong> from the clipboard?',
|
|
2213
2215
|
},
|
|
2214
2216
|
propertyActions: {
|
|
2215
2217
|
tooltipForPropertyActionsMenu: 'Open Property Actions',
|
|
@@ -497,7 +497,7 @@ export default {
|
|
|
497
497
|
anchorLinkPicker: 'Anchor or querystring',
|
|
498
498
|
anchorInsert: 'Name',
|
|
499
499
|
closeThisWindow: 'Close this window',
|
|
500
|
-
confirmdelete:
|
|
500
|
+
confirmdelete: (name: string) => `Are you sure you want to delete${name ? ` <strong>${name}</strong>` : ''}?`,
|
|
501
501
|
confirmdeleteNumberOfItems: 'Are you sure you want to delete <strong>%0%</strong> of <strong>%1%</strong> items',
|
|
502
502
|
confirmdisable: 'Are you sure you want to disable',
|
|
503
503
|
confirmremove: 'Are you sure you want to remove',
|
|
@@ -2388,6 +2388,8 @@ export default {
|
|
|
2388
2388
|
labelForRemoveAllEntries: 'Remove all items',
|
|
2389
2389
|
labelForClearClipboard: 'Clear clipboard',
|
|
2390
2390
|
labelForCopyToClipboard: 'Copy to clipboard',
|
|
2391
|
+
confirmDeleteHeadline: 'Delete from clipboard',
|
|
2392
|
+
confirmDeleteDescription: 'Are you sure you want to delete <strong>{0}</strong> from the clipboard?',
|
|
2391
2393
|
},
|
|
2392
2394
|
propertyActions: {
|
|
2393
2395
|
tooltipForPropertyActionsMenu: 'Open Property Actions',
|
|
@@ -416,6 +416,8 @@ export type CurrenUserConfigurationResponseModel = {
|
|
|
416
416
|
*/
|
|
417
417
|
usernameIsEmail: boolean;
|
|
418
418
|
passwordConfiguration: (PasswordConfigurationResponseModel);
|
|
419
|
+
allowChangePassword: boolean;
|
|
420
|
+
allowTwoFactor: boolean;
|
|
419
421
|
};
|
|
420
422
|
export type DatabaseInstallRequestModel = {
|
|
421
423
|
id: string;
|
|
@@ -68,7 +68,8 @@ export declare class UmbLocalizationController<LocalizationSetType extends UmbLo
|
|
|
68
68
|
* If the term is found in the localization set, it will be replaced with the localized term.
|
|
69
69
|
* If the term is not found, the original term will be returned.
|
|
70
70
|
* @param {string} text The text to translate.
|
|
71
|
+
* @param {...any} args The arguments to parse for this localization entry.
|
|
71
72
|
* @returns {string} The translated text.
|
|
72
73
|
*/
|
|
73
|
-
string(text: unknown): string;
|
|
74
|
+
string(text: unknown, ...args: any): string;
|
|
74
75
|
}
|
|
@@ -148,9 +148,10 @@ export class UmbLocalizationController {
|
|
|
148
148
|
* If the term is found in the localization set, it will be replaced with the localized term.
|
|
149
149
|
* If the term is not found, the original term will be returned.
|
|
150
150
|
* @param {string} text The text to translate.
|
|
151
|
+
* @param {...any} args The arguments to parse for this localization entry.
|
|
151
152
|
* @returns {string} The translated text.
|
|
152
153
|
*/
|
|
153
|
-
string(text) {
|
|
154
|
+
string(text, ...args) {
|
|
154
155
|
if (typeof text !== 'string') {
|
|
155
156
|
return '';
|
|
156
157
|
}
|
|
@@ -158,10 +159,9 @@ export class UmbLocalizationController {
|
|
|
158
159
|
const regex = /#\w+/g;
|
|
159
160
|
const localizedText = text.replace(regex, (match) => {
|
|
160
161
|
const key = match.slice(1);
|
|
161
|
-
// TODO: find solution to pass dynamic string to term
|
|
162
162
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
163
163
|
// @ts-ignore
|
|
164
|
-
const localized = this.term(key);
|
|
164
|
+
const localized = this.term(key, ...args);
|
|
165
165
|
// we didn't find a localized string, so we return the original string with the #
|
|
166
166
|
return localized === key ? match : localized;
|
|
167
167
|
});
|
|
@@ -18,11 +18,15 @@ export const manifests = [
|
|
|
18
18
|
type: 'entityAction',
|
|
19
19
|
kind: 'delete',
|
|
20
20
|
alias: 'Umb.EntityAction.ClipboardEntry.Delete',
|
|
21
|
-
name: 'Delete
|
|
21
|
+
name: 'Delete Clipboard Entry Entity Action',
|
|
22
22
|
forEntityTypes: [UMB_CLIPBOARD_ENTRY_ENTITY_TYPE],
|
|
23
23
|
meta: {
|
|
24
24
|
itemRepositoryAlias: UMB_CLIPBOARD_ENTRY_ITEM_REPOSITORY_ALIAS,
|
|
25
25
|
detailRepositoryAlias: UMB_CLIPBOARD_ENTRY_DETAIL_REPOSITORY_ALIAS,
|
|
26
|
+
confirm: {
|
|
27
|
+
headline: '#clipboard_confirmDeleteHeadline',
|
|
28
|
+
message: '#clipboard_confirmDeleteDescription',
|
|
29
|
+
},
|
|
26
30
|
},
|
|
27
31
|
},
|
|
28
32
|
];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UmbEntityActionBase } from '../../entity-action-base.js';
|
|
2
2
|
import type { MetaEntityActionDeleteKind } from './types.js';
|
|
3
3
|
export declare class UmbDeleteEntityAction extends UmbEntityActionBase<MetaEntityActionDeleteKind> {
|
|
4
|
+
#private;
|
|
4
5
|
execute(): Promise<void>;
|
|
5
6
|
}
|
|
6
7
|
export default UmbDeleteEntityAction;
|
|
@@ -3,8 +3,10 @@ import { UmbRequestReloadStructureForEntityEvent } from '../../request-reload-st
|
|
|
3
3
|
import { createExtensionApiByAlias } from '../../../extension-registry/index.js';
|
|
4
4
|
import { umbConfirmModal } from '../../../modal/index.js';
|
|
5
5
|
import { UMB_ACTION_EVENT_CONTEXT } from '../../../action/index.js';
|
|
6
|
+
import { UmbLocalizationController } from '../../../../../libs/localization-api/index.js';
|
|
6
7
|
export class UmbDeleteEntityAction extends UmbEntityActionBase {
|
|
7
8
|
// TODO: make base type for item and detail models
|
|
9
|
+
#localize = new UmbLocalizationController(this);
|
|
8
10
|
async execute() {
|
|
9
11
|
if (!this.args.unique)
|
|
10
12
|
throw new Error('Cannot delete an item without a unique identifier.');
|
|
@@ -13,12 +15,14 @@ export class UmbDeleteEntityAction extends UmbEntityActionBase {
|
|
|
13
15
|
const item = data?.[0];
|
|
14
16
|
if (!item)
|
|
15
17
|
throw new Error('Item not found.');
|
|
18
|
+
const headline = this.args.meta.confirm?.headline ?? '#actions_delete';
|
|
19
|
+
const message = this.args.meta.confirm?.message ?? '#defaultdialogs_confirmdelete';
|
|
16
20
|
// TODO: handle items with variants
|
|
17
21
|
await umbConfirmModal(this._host, {
|
|
18
|
-
headline
|
|
19
|
-
content:
|
|
22
|
+
headline,
|
|
23
|
+
content: this.#localize.string(message, item.name),
|
|
20
24
|
color: 'danger',
|
|
21
|
-
confirmLabel: '
|
|
25
|
+
confirmLabel: '#general_delete',
|
|
22
26
|
});
|
|
23
27
|
const detailRepository = await createExtensionApiByAlias(this, this.args.meta.detailRepositoryAlias);
|
|
24
28
|
await detailRepository.delete(this.args.unique);
|
|
@@ -6,6 +6,10 @@ export interface ManifestEntityActionDeleteKind extends ManifestEntityAction<Met
|
|
|
6
6
|
export interface MetaEntityActionDeleteKind extends MetaEntityActionDefaultKind {
|
|
7
7
|
detailRepositoryAlias: string;
|
|
8
8
|
itemRepositoryAlias: string;
|
|
9
|
+
confirm?: {
|
|
10
|
+
headline?: string;
|
|
11
|
+
message?: string;
|
|
12
|
+
};
|
|
9
13
|
}
|
|
10
14
|
declare global {
|
|
11
15
|
interface UmbExtensionManifestMap {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UMB_USER_ENTITY_TYPE } from '../../user/index.js';
|
|
1
|
+
import { UMB_USER_ALLOW_CHANGE_PASSWORD_CONDITION_ALIAS, UMB_USER_ENTITY_TYPE } from '../../user/index.js';
|
|
2
2
|
export const manifests = [
|
|
3
3
|
{
|
|
4
4
|
type: 'entityAction',
|
|
@@ -17,7 +17,7 @@ export const manifests = [
|
|
|
17
17
|
alias: 'Umb.Condition.User.IsDefaultKind',
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
alias:
|
|
20
|
+
alias: UMB_USER_ALLOW_CHANGE_PASSWORD_CONDITION_ALIAS,
|
|
21
21
|
},
|
|
22
22
|
],
|
|
23
23
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UMB_CURRENT_USER_ALLOW_MFA_CONDITION_ALIAS } from '../../user/index.js';
|
|
1
2
|
export const manifests = [
|
|
2
3
|
{
|
|
3
4
|
type: 'currentUserAction',
|
|
@@ -13,7 +14,7 @@ export const manifests = [
|
|
|
13
14
|
},
|
|
14
15
|
conditions: [
|
|
15
16
|
{
|
|
16
|
-
alias:
|
|
17
|
+
alias: UMB_CURRENT_USER_ALLOW_MFA_CONDITION_ALIAS,
|
|
17
18
|
},
|
|
18
19
|
],
|
|
19
20
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UMB_SECTION_USER_PERMISSION_CONDITION_ALIAS } from '../../../core/section/index.js';
|
|
2
|
+
import { UMB_CURRENT_USER_ALLOW_CHANGE_PASSWORD_CONDITION_ALIAS } from '../../user/index.js';
|
|
2
3
|
export const manifests = [
|
|
3
4
|
{
|
|
4
5
|
type: 'userProfileApp',
|
|
@@ -42,7 +43,7 @@ export const manifests = [
|
|
|
42
43
|
},
|
|
43
44
|
conditions: [
|
|
44
45
|
{
|
|
45
|
-
alias:
|
|
46
|
+
alias: UMB_CURRENT_USER_ALLOW_CHANGE_PASSWORD_CONDITION_ALIAS,
|
|
46
47
|
},
|
|
47
48
|
],
|
|
48
49
|
},
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UmbControllerHost } from '../../../../../libs/controller-api/index.js';
|
|
2
|
+
import type { UmbConditionConfigBase } from '../../../../../libs/extension-api/index.js';
|
|
3
|
+
import { UmbConditionBase } from '../../../../core/extension-registry/index.js';
|
|
4
|
+
export declare class UmbCurrentUserAllowChangePasswordActionCondition extends UmbConditionBase<UmbConditionConfigBase> {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(host: UmbControllerHost, args: any);
|
|
7
|
+
}
|
|
8
|
+
export { UmbCurrentUserAllowChangePasswordActionCondition as api };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import UmbCurrentUserConfigRepository from '../../repository/config/current-user-config.repository.js';
|
|
2
|
+
import { UmbConditionBase } from '../../../../core/extension-registry/index.js';
|
|
3
|
+
export class UmbCurrentUserAllowChangePasswordActionCondition extends UmbConditionBase {
|
|
4
|
+
#configRepository = new UmbCurrentUserConfigRepository(this._host);
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
constructor(host, args) {
|
|
7
|
+
super(host, args);
|
|
8
|
+
this.#init();
|
|
9
|
+
}
|
|
10
|
+
async #init() {
|
|
11
|
+
await this.#configRepository.initialized;
|
|
12
|
+
this.observe(this.#configRepository.part('allowChangePassword'), (isAllowed) => {
|
|
13
|
+
this.permitted = isAllowed;
|
|
14
|
+
}, '_userAllowChangePasswordActionCondition');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export { UmbCurrentUserAllowChangePasswordActionCondition as api };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UMB_USER_ALLOW_CHANGE_PASSWORD_CONDITION_ALIAS } from './constants.js';
|
|
1
|
+
import { UMB_CURRENT_USER_ALLOW_CHANGE_PASSWORD_CONDITION_ALIAS, UMB_USER_ALLOW_CHANGE_PASSWORD_CONDITION_ALIAS } from './constants.js';
|
|
2
2
|
export const manifests = [
|
|
3
3
|
{
|
|
4
4
|
type: 'condition',
|
|
@@ -6,4 +6,10 @@ export const manifests = [
|
|
|
6
6
|
alias: UMB_USER_ALLOW_CHANGE_PASSWORD_CONDITION_ALIAS,
|
|
7
7
|
api: () => import('./user-allow-change-password-action.condition.js'),
|
|
8
8
|
},
|
|
9
|
+
{
|
|
10
|
+
type: 'condition',
|
|
11
|
+
name: 'Current User Allow Change Password Condition',
|
|
12
|
+
alias: UMB_CURRENT_USER_ALLOW_CHANGE_PASSWORD_CONDITION_ALIAS,
|
|
13
|
+
api: () => import('./current-user-allow-change-password-action.condition.js'),
|
|
14
|
+
},
|
|
9
15
|
];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UmbControllerHost } from '../../../../../libs/controller-api/index.js';
|
|
2
|
+
import { UmbConditionBase } from '../../../../core/extension-registry/index.js';
|
|
3
|
+
export declare class UmbCurrentUserAllowMfaActionCondition extends UmbConditionBase<never> {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(host: UmbControllerHost, args: any);
|
|
6
|
+
}
|
|
7
|
+
export { UmbCurrentUserAllowMfaActionCondition as api };
|
package/dist-cms/packages/user/user/conditions/allow-mfa/current-user-allow-mfa-action.condition.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UmbCurrentUserConfigRepository } from '../../repository/config/index.js';
|
|
2
|
+
import { UmbConditionBase, umbExtensionsRegistry } from '../../../../core/extension-registry/index.js';
|
|
3
|
+
import { observeMultiple } from '../../../../../libs/observable-api/index.js';
|
|
4
|
+
export class UmbCurrentUserAllowMfaActionCondition extends UmbConditionBase {
|
|
5
|
+
#configRepository = new UmbCurrentUserConfigRepository(this._host);
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
constructor(host, args) {
|
|
8
|
+
super(host, args);
|
|
9
|
+
this.#init();
|
|
10
|
+
}
|
|
11
|
+
async #init() {
|
|
12
|
+
await this.#configRepository.initialized;
|
|
13
|
+
this.observe(observeMultiple([
|
|
14
|
+
this.#configRepository.part('allowTwoFactor'),
|
|
15
|
+
umbExtensionsRegistry.byType('mfaLoginProvider'),
|
|
16
|
+
]), ([allowTwoFactor, exts]) => {
|
|
17
|
+
this.permitted = allowTwoFactor && exts.length > 0;
|
|
18
|
+
}, '_userAllowMfaActionCondition');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export { UmbCurrentUserAllowMfaActionCondition as api };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UMB_USER_ALLOW_MFA_CONDITION_ALIAS } from './constants.js';
|
|
1
|
+
import { UMB_USER_ALLOW_MFA_CONDITION_ALIAS, UMB_CURRENT_USER_ALLOW_MFA_CONDITION_ALIAS } from './constants.js';
|
|
2
2
|
export const manifests = [
|
|
3
3
|
{
|
|
4
4
|
type: 'condition',
|
|
@@ -6,4 +6,10 @@ export const manifests = [
|
|
|
6
6
|
alias: UMB_USER_ALLOW_MFA_CONDITION_ALIAS,
|
|
7
7
|
api: () => import('./user-allow-mfa-action.condition.js'),
|
|
8
8
|
},
|
|
9
|
+
{
|
|
10
|
+
type: 'condition',
|
|
11
|
+
name: 'Current User Allow Mfa Action Condition',
|
|
12
|
+
alias: UMB_CURRENT_USER_ALLOW_MFA_CONDITION_ALIAS,
|
|
13
|
+
api: () => import('./current-user-allow-mfa-action.condition.js'),
|
|
14
|
+
},
|
|
9
15
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UMB_USER_DETAIL_REPOSITORY_ALIAS, UMB_USER_ITEM_REPOSITORY_ALIAS } from '../constants.js';
|
|
1
|
+
import { UMB_USER_ALLOW_MFA_CONDITION_ALIAS, UMB_USER_DETAIL_REPOSITORY_ALIAS, UMB_USER_ITEM_REPOSITORY_ALIAS } from '../constants.js';
|
|
2
2
|
import { UMB_USER_ENTITY_TYPE } from '../entity.js';
|
|
3
3
|
import { manifests as createManifests } from './create/manifests.js';
|
|
4
4
|
const entityActions = [
|
|
@@ -87,7 +87,7 @@ const entityActions = [
|
|
|
87
87
|
},
|
|
88
88
|
conditions: [
|
|
89
89
|
{
|
|
90
|
-
alias:
|
|
90
|
+
alias: UMB_USER_ALLOW_MFA_CONDITION_ALIAS,
|
|
91
91
|
},
|
|
92
92
|
],
|
|
93
93
|
},
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export declare const UMB_USER_CONFIG_REPOSITORY_ALIAS = "Umb.Repository.User.Config";
|
|
2
2
|
export declare const UMB_USER_CONFIG_STORE_ALIAS = "Umb.Store.User.Config";
|
|
3
3
|
export { UMB_USER_CONFIG_STORE_CONTEXT } from './user-config.store.token.js';
|
|
4
|
+
export declare const UMB_CURRENT_USER_CONFIG_REPOSITORY_ALIAS = "Umb.Repository.CurrentUser.Config";
|
|
5
|
+
export declare const UMB_CURRENT_USER_CONFIG_STORE_ALIAS = "Umb.Store.CurrentUser.Config";
|
|
6
|
+
export { UMB_CURRENT_USER_CONFIG_STORE_CONTEXT } from './current-user-config.store.token.js';
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export const UMB_USER_CONFIG_REPOSITORY_ALIAS = 'Umb.Repository.User.Config';
|
|
2
2
|
export const UMB_USER_CONFIG_STORE_ALIAS = 'Umb.Store.User.Config';
|
|
3
3
|
export { UMB_USER_CONFIG_STORE_CONTEXT } from './user-config.store.token.js';
|
|
4
|
+
export const UMB_CURRENT_USER_CONFIG_REPOSITORY_ALIAS = 'Umb.Repository.CurrentUser.Config';
|
|
5
|
+
export const UMB_CURRENT_USER_CONFIG_STORE_ALIAS = 'Umb.Store.CurrentUser.Config';
|
|
6
|
+
export { UMB_CURRENT_USER_CONFIG_STORE_CONTEXT } from './current-user-config.store.token.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { UmbCurrentUserConfigurationModel } from '../../types.js';
|
|
2
|
+
import { UmbRepositoryBase } from '../../../../core/repository/index.js';
|
|
3
|
+
import type { UmbApi } from '../../../../../libs/extension-api/index.js';
|
|
4
|
+
import type { UmbControllerHost } from '../../../../../libs/controller-api/index.js';
|
|
5
|
+
import type { Observable } from '../../../../../libs/observable-api/index.js';
|
|
6
|
+
export declare class UmbCurrentUserConfigRepository extends UmbRepositoryBase implements UmbApi {
|
|
7
|
+
#private;
|
|
8
|
+
/**
|
|
9
|
+
* Promise that resolves when the repository has been initialized, i.e. when the user configuration has been fetched from the server.
|
|
10
|
+
* @memberof UmbCurrentUserConfigRepository
|
|
11
|
+
*/
|
|
12
|
+
initialized: Promise<void>;
|
|
13
|
+
constructor(host: UmbControllerHost);
|
|
14
|
+
/**
|
|
15
|
+
* Subscribe to the entire user configuration.
|
|
16
|
+
*/
|
|
17
|
+
all(): Observable<import("../../../../../external/backend-api/index.js").CurrenUserConfigurationResponseModel | null>;
|
|
18
|
+
/**
|
|
19
|
+
* Subscribe to a part of the user configuration.
|
|
20
|
+
* @param part
|
|
21
|
+
*/
|
|
22
|
+
part<Part extends keyof UmbCurrentUserConfigurationModel>(part: Part): Observable<UmbCurrentUserConfigurationModel[Part]>;
|
|
23
|
+
}
|
|
24
|
+
export default UmbCurrentUserConfigRepository;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { UmbCurrentUserConfigServerDataSource } from './current-user-config.server.data-source.js';
|
|
2
|
+
import { UMB_CURRENT_USER_CONFIG_STORE_CONTEXT } from './current-user-config.store.token.js';
|
|
3
|
+
import { UmbRepositoryBase } from '../../../../core/repository/index.js';
|
|
4
|
+
export class UmbCurrentUserConfigRepository extends UmbRepositoryBase {
|
|
5
|
+
#dataStore;
|
|
6
|
+
#dataSource = new UmbCurrentUserConfigServerDataSource(this);
|
|
7
|
+
constructor(host) {
|
|
8
|
+
super(host);
|
|
9
|
+
this.initialized = new Promise((resolve) => {
|
|
10
|
+
this.consumeContext(UMB_CURRENT_USER_CONFIG_STORE_CONTEXT, async (store) => {
|
|
11
|
+
this.#dataStore = store;
|
|
12
|
+
await this.#init();
|
|
13
|
+
resolve();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async #init() {
|
|
18
|
+
// Check if the store already has data
|
|
19
|
+
if (this.#dataStore?.getState()) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const { data } = await this.#dataSource.getCurrentUserConfig();
|
|
23
|
+
if (data) {
|
|
24
|
+
this.#dataStore?.update(data);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Subscribe to the entire user configuration.
|
|
29
|
+
*/
|
|
30
|
+
all() {
|
|
31
|
+
if (!this.#dataStore) {
|
|
32
|
+
throw new Error('Data store not initialized');
|
|
33
|
+
}
|
|
34
|
+
return this.#dataStore.all();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Subscribe to a part of the user configuration.
|
|
38
|
+
* @param part
|
|
39
|
+
*/
|
|
40
|
+
part(part) {
|
|
41
|
+
if (!this.#dataStore) {
|
|
42
|
+
throw new Error('Data store not initialized');
|
|
43
|
+
}
|
|
44
|
+
return this.#dataStore.part(part);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export default UmbCurrentUserConfigRepository;
|
package/dist-cms/packages/user/user/repository/config/current-user-config.server.data-source.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UmbControllerHost } from '../../../../../libs/controller-api/index.js';
|
|
2
|
+
export declare class UmbCurrentUserConfigServerDataSource {
|
|
3
|
+
#private;
|
|
4
|
+
constructor(host: UmbControllerHost);
|
|
5
|
+
/**
|
|
6
|
+
* Get the current user configuration.
|
|
7
|
+
* @memberof UmbCurrentUserConfigServerDataSource
|
|
8
|
+
*/
|
|
9
|
+
getCurrentUserConfig(): Promise<import("../../../../core/repository/index.js").UmbDataSourceResponse<import("src/external/backend-api/src").CurrenUserConfigurationResponseModel>>;
|
|
10
|
+
}
|
package/dist-cms/packages/user/user/repository/config/current-user-config.server.data-source.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UserService } from '../../../../../external/backend-api/index.js';
|
|
2
|
+
import { tryExecuteAndNotify } from '../../../../core/resources/index.js';
|
|
3
|
+
export class UmbCurrentUserConfigServerDataSource {
|
|
4
|
+
#host;
|
|
5
|
+
constructor(host) {
|
|
6
|
+
this.#host = host;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Get the current user configuration.
|
|
10
|
+
* @memberof UmbCurrentUserConfigServerDataSource
|
|
11
|
+
*/
|
|
12
|
+
getCurrentUserConfig() {
|
|
13
|
+
return tryExecuteAndNotify(this.#host, UserService.getUserCurrentConfiguration());
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UmbCurrentUserConfigurationModel } from '../../types.js';
|
|
2
|
+
import type { UmbControllerHost } from '../../../../../libs/controller-api/index.js';
|
|
3
|
+
import { UmbStoreObjectBase } from '../../../../core/store/index.js';
|
|
4
|
+
export declare class UmbCurrentUserConfigStore extends UmbStoreObjectBase<UmbCurrentUserConfigurationModel> {
|
|
5
|
+
constructor(host: UmbControllerHost);
|
|
6
|
+
}
|
|
7
|
+
export default UmbCurrentUserConfigStore;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UMB_CURRENT_USER_CONFIG_STORE_CONTEXT } from './current-user-config.store.token.js';
|
|
2
|
+
import { UmbStoreObjectBase } from '../../../../core/store/index.js';
|
|
3
|
+
export class UmbCurrentUserConfigStore extends UmbStoreObjectBase {
|
|
4
|
+
constructor(host) {
|
|
5
|
+
super(host, UMB_CURRENT_USER_CONFIG_STORE_CONTEXT.toString());
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export default UmbCurrentUserConfigStore;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { UmbCurrentUserConfigStore } from './current-user-config.store.js';
|
|
2
|
+
import { UmbContextToken } from '../../../../../libs/context-api/index.js';
|
|
3
|
+
export declare const UMB_CURRENT_USER_CONFIG_STORE_CONTEXT: UmbContextToken<UmbCurrentUserConfigStore, UmbCurrentUserConfigStore>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UMB_USER_CONFIG_REPOSITORY_ALIAS, UMB_USER_CONFIG_STORE_ALIAS } from './constants.js';
|
|
1
|
+
import { UMB_CURRENT_USER_CONFIG_REPOSITORY_ALIAS, UMB_CURRENT_USER_CONFIG_STORE_ALIAS, UMB_USER_CONFIG_REPOSITORY_ALIAS, UMB_USER_CONFIG_STORE_ALIAS } from './constants.js';
|
|
2
2
|
export const manifests = [
|
|
3
3
|
{
|
|
4
4
|
type: 'store',
|
|
@@ -12,4 +12,16 @@ export const manifests = [
|
|
|
12
12
|
name: 'User Config Repository',
|
|
13
13
|
api: () => import('./user-config.repository.js'),
|
|
14
14
|
},
|
|
15
|
+
{
|
|
16
|
+
type: 'store',
|
|
17
|
+
alias: UMB_CURRENT_USER_CONFIG_STORE_ALIAS,
|
|
18
|
+
name: 'Current User Config Store',
|
|
19
|
+
api: () => import('./current-user-config.store.js'),
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: 'repository',
|
|
23
|
+
alias: UMB_CURRENT_USER_CONFIG_REPOSITORY_ALIAS,
|
|
24
|
+
name: 'Current User Config Repository',
|
|
25
|
+
api: () => import('./current-user-config.repository.js'),
|
|
26
|
+
},
|
|
15
27
|
];
|
|
@@ -7,4 +7,9 @@ export declare class UmbUserConfigServerDataSource {
|
|
|
7
7
|
* @memberof UmbUserConfigServerDataSource
|
|
8
8
|
*/
|
|
9
9
|
getUserConfig(): Promise<import("../../../../core/repository/index.js").UmbDataSourceResponse<import("src/external/backend-api/src").UserConfigurationResponseModel>>;
|
|
10
|
+
/**
|
|
11
|
+
* Get the current user configuration.
|
|
12
|
+
* @memberof UmbUserConfigServerDataSource
|
|
13
|
+
*/
|
|
14
|
+
getCurrentUserConfig(): Promise<import("../../../../core/repository/index.js").UmbDataSourceResponse<import("src/external/backend-api/src").CurrenUserConfigurationResponseModel>>;
|
|
10
15
|
}
|
|
@@ -12,4 +12,11 @@ export class UmbUserConfigServerDataSource {
|
|
|
12
12
|
getUserConfig() {
|
|
13
13
|
return tryExecuteAndNotify(this.#host, UserService.getUserConfiguration());
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Get the current user configuration.
|
|
17
|
+
* @memberof UmbUserConfigServerDataSource
|
|
18
|
+
*/
|
|
19
|
+
getCurrentUserConfig() {
|
|
20
|
+
return tryExecuteAndNotify(this.#host, UserService.getUserCurrentConfiguration());
|
|
21
|
+
}
|
|
15
22
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { UmbUserEntityType } from './entity.js';
|
|
2
2
|
import type { UmbUserKindType } from './utils/index.js';
|
|
3
3
|
import type { UmbReferenceByUnique } from '../../core/models/index.js';
|
|
4
|
-
import { type UserConfigurationResponseModel, UserStateModel, type UserTwoFactorProviderModel } from '../../../external/backend-api/index.js';
|
|
4
|
+
import { type CurrenUserConfigurationResponseModel, type UserConfigurationResponseModel, UserStateModel, type UserTwoFactorProviderModel } from '../../../external/backend-api/index.js';
|
|
5
5
|
export type * from './conditions/types.js';
|
|
6
6
|
export type UmbUserStateEnum = UserStateModel;
|
|
7
7
|
export declare const UmbUserStateEnum: typeof UserStateModel;
|
|
@@ -32,3 +32,4 @@ export interface UmbUserStartNodesModel {
|
|
|
32
32
|
}
|
|
33
33
|
export type UmbUserMfaProviderModel = UserTwoFactorProviderModel;
|
|
34
34
|
export type UmbUserConfigurationModel = UserConfigurationResponseModel;
|
|
35
|
+
export type UmbCurrentUserConfigurationModel = CurrenUserConfigurationResponseModel;
|