Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export class UmbInputDocumentGranularUserPermissionElement extends UUIFormContro
const name = item.variants[0]?.name;
const headline = name ? `Permissions for ${name}` : 'Permissions';
const fallbackVerbs = this.#getFallbackPermissionVerbsForEntityType(item.entityType);
const value = allowedVerbs.length > 0 ? { allowedVerbs } : undefined;
this.#entityUserPermissionModalContext = this.#modalManagerContext?.open(this, UMB_ENTITY_USER_PERMISSION_MODAL, {
data: {
unique: item.unique,
Expand All @@ -135,16 +136,16 @@ export class UmbInputDocumentGranularUserPermissionElement extends UUIFormContro
allowedVerbs: fallbackVerbs,
},
},
value: {
allowedVerbs: allowedVerbs,
},
value,
});

try {
// When the modal is submitted we return the new value from the modal
const value = await this.#entityUserPermissionModalContext?.onSubmit();
return value?.allowedVerbs;
} catch {
throw new Error();
// When the modal is rejected we return the current value
return allowedVerbs;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export class UmbEntityUserPermissionSettingsModalElement extends UmbModalBaseEle
override connectedCallback(): void {
super.connectedCallback();

if (this._preset?.allowedVerbs) {
this.updateValue({ allowedVerbs: this._preset?.allowedVerbs });
if (this._preset?.allowedVerbs && !this.value?.allowedVerbs) {
this.updateValue({ allowedVerbs: this._preset.allowedVerbs });
}
}

Expand Down
Loading