@umbraco-cms/backoffice 14.0.0--preview004-14ef63c3 → 14.0.0--preview004-53edbae7

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.
@@ -4,8 +4,10 @@ export interface ManifestUserPermission extends ManifestBase {
4
4
  meta: MetaUserPermission;
5
5
  }
6
6
  export interface MetaUserPermission {
7
- label: string;
8
7
  entityType: string;
8
+ label?: string;
9
+ labelKey?: string;
9
10
  description?: string;
11
+ descriptionKey?: string;
10
12
  group?: string;
11
13
  }
@@ -21,8 +21,8 @@ const permissions = [
21
21
  name: 'Read Document User Permission',
22
22
  meta: {
23
23
  entityType: 'document',
24
- label: 'Read',
25
- description: 'Allow access to browse documents',
24
+ labelKey: 'actions_browse',
25
+ descriptionKey: 'actionDescriptions_browse',
26
26
  },
27
27
  },
28
28
  {
@@ -31,8 +31,8 @@ const permissions = [
31
31
  name: 'Create Document Blueprint User Permission',
32
32
  meta: {
33
33
  entityType: 'document',
34
- label: 'Create Content Template',
35
- description: 'Allow access to create a Content Template',
34
+ labelKey: 'actions_createblueprint',
35
+ descriptionKey: 'actionDescriptions_createblueprint',
36
36
  },
37
37
  },
38
38
  {
@@ -41,8 +41,8 @@ const permissions = [
41
41
  name: 'Delete Document User Permission',
42
42
  meta: {
43
43
  entityType: 'document',
44
- label: 'Delete',
45
- description: 'Allow access to delete a document',
44
+ labelKey: 'actions_delete',
45
+ descriptionKey: 'actionDescriptions_delete',
46
46
  },
47
47
  },
48
48
  {
@@ -51,8 +51,8 @@ const permissions = [
51
51
  name: 'Create Document User Permission',
52
52
  meta: {
53
53
  entityType: 'document',
54
- label: 'Create',
55
- description: 'Allow access to create a document',
54
+ labelKey: 'actions_create',
55
+ descriptionKey: 'actionDescriptions_create',
56
56
  },
57
57
  },
58
58
  {
@@ -61,8 +61,8 @@ const permissions = [
61
61
  name: 'Document Notifications User Permission',
62
62
  meta: {
63
63
  entityType: 'document',
64
- label: 'Notifications',
65
- description: 'Allow access to setup notifications for documents',
64
+ labelKey: 'actions_notify',
65
+ descriptionKey: 'actionDescriptions_notify',
66
66
  },
67
67
  },
68
68
  {
@@ -71,8 +71,8 @@ const permissions = [
71
71
  name: 'Publish Document User Permission',
72
72
  meta: {
73
73
  entityType: 'document',
74
- label: 'Publish',
75
- description: 'Allow access to publish a document',
74
+ labelKey: 'actions_publish',
75
+ descriptionKey: 'actionDescriptions_publish',
76
76
  },
77
77
  },
78
78
  {
@@ -81,8 +81,8 @@ const permissions = [
81
81
  name: 'Document Permissions User Permission',
82
82
  meta: {
83
83
  entityType: 'document',
84
- label: 'Permissions',
85
- description: 'Allow access to change permissions for a document',
84
+ labelKey: 'actions_setPermissions',
85
+ descriptionKey: 'actionDescriptions_rights',
86
86
  },
87
87
  },
88
88
  {
@@ -91,8 +91,8 @@ const permissions = [
91
91
  name: 'Send Document For Approval User Permission',
92
92
  meta: {
93
93
  entityType: 'document',
94
- label: 'Send For Approval',
95
- description: 'Allow access to send a document for approval before publishing',
94
+ labelKey: 'actions_sendtopublish',
95
+ descriptionKey: 'actionDescriptions_sendtopublish',
96
96
  },
97
97
  },
98
98
  {
@@ -101,8 +101,8 @@ const permissions = [
101
101
  name: 'Unpublish Document User Permission',
102
102
  meta: {
103
103
  entityType: 'document',
104
- label: 'Unpublish',
105
- description: 'Allow access to unpublish a document',
104
+ labelKey: 'actions_unpublish',
105
+ descriptionKey: 'actionDescriptions_unpublish',
106
106
  },
107
107
  },
108
108
  {
@@ -111,8 +111,8 @@ const permissions = [
111
111
  name: 'Update Document User Permission',
112
112
  meta: {
113
113
  entityType: 'document',
114
- label: 'Update',
115
- description: 'Allow access to save a document',
114
+ labelKey: 'actions_update',
115
+ descriptionKey: 'actionDescriptions_update',
116
116
  },
117
117
  },
118
118
  {
@@ -121,8 +121,8 @@ const permissions = [
121
121
  name: 'Copy Document User Permission',
122
122
  meta: {
123
123
  entityType: 'document',
124
- label: 'Copy',
125
- description: 'Allow access to copy a document',
124
+ labelKey: 'actions_copy',
125
+ descriptionKey: 'actionDescriptions_copy',
126
126
  group: 'structure',
127
127
  },
128
128
  },
@@ -132,8 +132,8 @@ const permissions = [
132
132
  name: 'Move Document User Permission',
133
133
  meta: {
134
134
  entityType: 'document',
135
- label: 'Move',
136
- description: 'Allow access to move a document',
135
+ labelKey: 'actions_move',
136
+ descriptionKey: 'actionDescriptions_move',
137
137
  group: 'structure',
138
138
  },
139
139
  },
@@ -143,8 +143,8 @@ const permissions = [
143
143
  name: 'Sort Document User Permission',
144
144
  meta: {
145
145
  entityType: 'document',
146
- label: 'Sort',
147
- description: 'Allow access to sort documents',
146
+ labelKey: 'actions_sort',
147
+ descriptionKey: 'actionDescriptions_sort',
148
148
  group: 'structure',
149
149
  },
150
150
  },
@@ -154,8 +154,8 @@ const permissions = [
154
154
  name: 'Document Culture And Hostnames User Permission',
155
155
  meta: {
156
156
  entityType: 'document',
157
- label: 'Culture And Hostnames',
158
- description: 'Allow access to set culture and hostnames for documents',
157
+ labelKey: 'actions_assigndomain',
158
+ descriptionKey: 'actionDescriptions_assignDomain',
159
159
  group: 'administration',
160
160
  },
161
161
  },
@@ -165,8 +165,8 @@ const permissions = [
165
165
  name: 'Document Public Access User Permission',
166
166
  meta: {
167
167
  entityType: 'document',
168
- label: 'Public Access',
169
- description: 'Allow access to set and change access restrictions for a document',
168
+ labelKey: 'actions_protect',
169
+ descriptionKey: 'actionDescriptions_protect',
170
170
  group: 'administration',
171
171
  },
172
172
  },
@@ -176,8 +176,8 @@ const permissions = [
176
176
  name: 'Document Rollback User Permission',
177
177
  meta: {
178
178
  entityType: 'document',
179
- label: 'Rollback',
180
- description: 'Allow access to roll back a document to a previous state',
179
+ labelKey: 'actions_rollback',
180
+ descriptionKey: 'actionDescriptions_rollback',
181
181
  group: 'administration',
182
182
  },
183
183
  },
@@ -5,10 +5,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { UMB_USER_GROUP_WORKSPACE_CONTEXT } from '../user-group-workspace.context.js';
8
- import { html, customElement, state, ifDefined } from '../../../../../external/lit/index.js';
8
+ import { html, customElement, state, ifDefined, nothing } from '../../../../../external/lit/index.js';
9
9
  import { UmbLitElement } from '../../../../../shared/lit-element/index.js';
10
10
  import { UmbTextStyles } from '../../../../../shared/style/index.js';
11
11
  import { umbExtensionsRegistry } from '../../../../core/extension-registry/index.js';
12
+ import { groupBy } from '../../../../../external/lodash/index.js';
12
13
  export let UmbUserGroupDefaultPermissionListElement = class UmbUserGroupDefaultPermissionListElement extends UmbLitElement {
13
14
  #userGroupWorkspaceContext;
14
15
  constructor() {
@@ -33,23 +34,35 @@ export let UmbUserGroupDefaultPermissionListElement = class UmbUserGroupDefaultP
33
34
  ? this.#userGroupWorkspaceContext?.addPermission(userPermissionManifest.alias)
34
35
  : this.#userGroupWorkspaceContext?.removePermission(userPermissionManifest.alias);
35
36
  }
36
- #isAllowed(userPermissionManifest) {
37
- return this._userGroup?.permissions?.includes(userPermissionManifest.alias);
37
+ #isAllowed(permissionAlias) {
38
+ return this._userGroup?.permissions?.includes(permissionAlias);
38
39
  }
39
40
  render() {
40
- return html ` ${this._entityTypes.map((entityType) => this.#renderPermissionsForEntityType(entityType))} `;
41
+ return html ` ${this._entityTypes.map((entityType) => this.#renderPermissionsByEntityType(entityType))} `;
41
42
  }
42
- #renderPermissionsForEntityType(entityType) {
43
- return html ` <h4><umb-localize .key=${`user_permissionsEntityGroup_${entityType}`}>${entityType}</umb-localize></h4>
44
- ${this._manifests
45
- .filter((manifest) => manifest.meta.entityType === entityType)
46
- .map((manifest) => this.#renderPermission(manifest))}`;
43
+ #renderPermissionsByEntityType(entityType) {
44
+ const permissionsForEntityType = this._manifests.filter((manifest) => manifest.meta.entityType === entityType);
45
+ return html `
46
+ <h4><umb-localize .key=${`user_permissionsEntityGroup_${entityType}`}>${entityType}</umb-localize></h4>
47
+ ${this.#renderGroupedPermissions(permissionsForEntityType)}
48
+ `;
49
+ }
50
+ #renderGroupedPermissions(permissions) {
51
+ const groupedPermissions = groupBy(permissions, (manifest) => manifest.meta.group);
52
+ return html `
53
+ ${Object.entries(groupedPermissions).map(([group, manifests]) => html `
54
+ ${group !== 'undefined'
55
+ ? html ` <h5><umb-localize .key=${`actionCategories_${group}`}>${group}</umb-localize></h5> `
56
+ : nothing}
57
+ ${manifests.map((manifest) => html ` ${this.#renderPermission(manifest)} `)}
58
+ `)}
59
+ `;
47
60
  }
48
61
  #renderPermission(manifest) {
49
62
  return html ` <umb-user-permission-setting
50
- label=${manifest.meta.label}
51
- description=${ifDefined(manifest.meta.description)}
52
- ?allowed=${this.#isAllowed(manifest)}
63
+ label=${ifDefined(manifest.meta.labelKey ? this.localize.term(manifest.meta.labelKey) : manifest.meta.label)}
64
+ description=${ifDefined(manifest.meta.descriptionKey ? this.localize.term(manifest.meta.descriptionKey) : manifest.meta.description)}
65
+ ?allowed=${this.#isAllowed(manifest.alias)}
53
66
  @change=${(event) => this.#onChangeUserPermission(event, manifest)}></umb-user-permission-setting>`;
54
67
  }
55
68
  static { this.styles = [UmbTextStyles]; }