Skip to content

Commit dc4d536

Browse files
committed
prevent name change of file system folders
1 parent 1b40aef commit dc4d536

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/tree/folder/workspace/partial-view-folder-workspace-editor.element.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
import { UMB_PARTIAL_VIEW_FOLDER_WORKSPACE_CONTEXT } from './partial-view-folder-workspace.context-token.js';
12
import { html, customElement } from '@umbraco-cms/backoffice/external/lit';
23
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
34

45
@customElement('umb-partial-view-folder-workspace-editor')
56
export class UmbPartialViewFolderWorkspaceEditorElement extends UmbLitElement {
7+
constructor() {
8+
super();
9+
10+
this.consumeContext(UMB_PARTIAL_VIEW_FOLDER_WORKSPACE_CONTEXT, (workspaceContext) => {
11+
workspaceContext?.nameWriteGuard.addRule({
12+
unique: 'UMB_SERVER_PREVENT_FILE_SYSTEM_FOLDER_RENAME',
13+
permitted: false,
14+
message: 'It is not possible to change the name of a Partial View folder.',
15+
});
16+
});
17+
}
18+
619
override render() {
720
return html`<umb-folder-workspace-editor></umb-folder-workspace-editor>`;
821
}

src/Umbraco.Web.UI.Client/src/packages/templating/scripts/tree/folder/workspace/script-folder-workspace-editor.element.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
import { UMB_SCRIPT_FOLDER_WORKSPACE_CONTEXT } from '../../../constants.js';
12
import { html, customElement } from '@umbraco-cms/backoffice/external/lit';
23
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
34

45
@customElement('umb-script-folder-workspace-editor')
56
export class UmbScriptFolderWorkspaceEditorElement extends UmbLitElement {
7+
constructor() {
8+
super();
9+
10+
this.consumeContext(UMB_SCRIPT_FOLDER_WORKSPACE_CONTEXT, (workspaceContext) => {
11+
workspaceContext?.nameWriteGuard.addRule({
12+
unique: 'UMB_SERVER_PREVENT_FILE_SYSTEM_FOLDER_RENAME',
13+
permitted: false,
14+
message: 'It is not possible to change the name of a script folder.',
15+
});
16+
});
17+
}
18+
619
override render() {
720
return html`<umb-folder-workspace-editor></umb-folder-workspace-editor>`;
821
}

src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/tree/folder/workspace/stylesheet-folder-workspace-editor.element.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
import { UMB_STYLESHEET_FOLDER_WORKSPACE_CONTEXT } from './stylesheet-folder-workspace.context-token.js';
12
import { html, customElement } from '@umbraco-cms/backoffice/external/lit';
23
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
34

45
@customElement('umb-stylesheet-folder-workspace-editor')
56
export class UmbStylesheetFolderWorkspaceEditorElement extends UmbLitElement {
7+
constructor() {
8+
super();
9+
10+
this.consumeContext(UMB_STYLESHEET_FOLDER_WORKSPACE_CONTEXT, (workspaceContext) => {
11+
workspaceContext?.nameWriteGuard.addRule({
12+
unique: 'UMB_SERVER_PREVENT_FILE_SYSTEM_FOLDER_RENAME',
13+
permitted: false,
14+
message: 'It is not possible to change the name of a Stylesheet folder.',
15+
});
16+
});
17+
}
18+
619
override render() {
720
return html`<umb-folder-workspace-editor></umb-folder-workspace-editor>`;
821
}

0 commit comments

Comments
 (0)