Skip to content

Commit 6c618ff

Browse files
committed
Merge branch 'v15/dev' into v15/feature/workspace-info-app-extension
2 parents 3571281 + c448190 commit 6c618ff

File tree

71 files changed

+637
-164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+637
-164
lines changed

src/Umbraco.Cms.Api.Management/Controllers/Document/CreateDocumentControllerBase.cs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,18 @@ protected CreateDocumentControllerBase(IAuthorizationService authorizationServic
1818

1919
protected async Task<IActionResult> HandleRequest(CreateDocumentRequestModel requestModel, Func<Task<IActionResult>> authorizedHandler)
2020
{
21-
// TODO This have temporarily been uncommented, to support the client sends values from all cultures, even when the user do not have access to the languages.
22-
// The values are ignored in the ContentEditingService
21+
// We intentionally don't pass in cultures here.
22+
// This is to support the client sending values for all cultures even if the user doesn't have access to the language.
23+
// Values for unauthorized languages are later ignored in the ContentEditingService.
24+
AuthorizationResult authorizationResult = await _authorizationService.AuthorizeResourceAsync(
25+
User,
26+
ContentPermissionResource.WithKeys(ActionNew.ActionLetter, requestModel.Parent?.Id),
27+
AuthorizationPolicies.ContentPermissionByResource);
2328

24-
// IEnumerable<string> cultures = requestModel.Variants
25-
// .Where(v => v.Culture is not null)
26-
// .Select(v => v.Culture!);
27-
// AuthorizationResult authorizationResult = await _authorizationService.AuthorizeResourceAsync(
28-
// User,
29-
// ContentPermissionResource.WithKeys(ActionNew.ActionLetter, requestModel.Parent?.Id, cultures),
30-
// AuthorizationPolicies.ContentPermissionByResource);
31-
//
32-
// if (!authorizationResult.Succeeded)
33-
// {
34-
// return Forbidden();
35-
// }
29+
if (authorizationResult.Succeeded is false)
30+
{
31+
return Forbidden();
32+
}
3633

3734
return await authorizedHandler();
3835
}

src/Umbraco.Web.UI.Client/src/apps/app/app.context.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { UmbAppContextConfig } from './app-context-config.interface.js';
2+
import { UmbNetworkConnectionStatusManager } from './network-connection-status.manager.js';
23
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
34
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
45
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
@@ -13,6 +14,8 @@ export class UmbAppContext extends UmbContextBase<UmbAppContext> {
1314
this.#serverUrl = config.serverUrl;
1415
this.#backofficePath = config.backofficePath;
1516
this.#serverConnection = config.serverConnection;
17+
18+
new UmbNetworkConnectionStatusManager(this);
1619
}
1720

1821
getBackofficePath() {
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
2+
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
3+
import { UmbLocalizationController } from '@umbraco-cms/backoffice/localization-api';
4+
import {
5+
UMB_NOTIFICATION_CONTEXT,
6+
type UmbNotificationContext,
7+
type UmbNotificationHandler,
8+
} from '@umbraco-cms/backoffice/notification';
9+
10+
export class UmbNetworkConnectionStatusManager extends UmbControllerBase {
11+
#notificationContext?: UmbNotificationContext;
12+
#offlineNotification?: UmbNotificationHandler;
13+
14+
#localize = new UmbLocalizationController(this);
15+
16+
constructor(host: UmbControllerHost) {
17+
super(host);
18+
19+
this.consumeContext(UMB_NOTIFICATION_CONTEXT, (notificationContext) => {
20+
this.#notificationContext = notificationContext;
21+
});
22+
23+
window.addEventListener('online', () => this.#onOnline());
24+
window.addEventListener('offline', () => this.#onOffline());
25+
}
26+
27+
#onOnline() {
28+
this.#offlineNotification?.close();
29+
this.#notificationContext?.peek('positive', {
30+
data: {
31+
headline: this.#localize.term('speechBubbles_onlineHeadline'),
32+
message: this.#localize.term('speechBubbles_onlineMessage'),
33+
},
34+
});
35+
}
36+
37+
#onOffline() {
38+
this.#offlineNotification = this.#notificationContext?.stay('danger', {
39+
data: {
40+
headline: this.#localize.term('speechBubbles_offlineHeadline'),
41+
message: this.#localize.term('speechBubbles_offlineMessage'),
42+
},
43+
});
44+
}
45+
46+
override destroy() {
47+
this.#offlineNotification?.close();
48+
this.removeEventListener('online', () => this.#onOnline());
49+
this.removeEventListener('offline', () => this.#onOffline());
50+
super.destroy();
51+
}
52+
}

src/Umbraco.Web.UI.Client/src/assets/lang/da-dk.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ export default {
345345
clickToUpload: 'Klik for at uploade',
346346
orClickHereToUpload: 'eller klik her for at vælge filer',
347347
disallowedFileType: 'Kan ikke uploade denne fil, den har ikke en godkendt filtype',
348+
disallowedMediaType: "Kan ikke uploade denne fil, mediatypen med alias '%0%' er ikke tilladt her",
349+
invalidFileName: 'Kan ikke uploade denne fil, den har et ugyldigt filnavn',
350+
invalidFileSize: 'Kan ikke uploade denne fil, den er for stor',
348351
maxFileSize: 'Maks filstørrelse er',
349352
mediaRoot: 'Medie rod',
350353
moveToSameFolderFailed: 'Overordnet og destinations mappe kan ikke være den samme',
@@ -353,8 +356,6 @@ export default {
353356
dragAndDropYourFilesIntoTheArea:
354357
'Træk dine filer ind i dropzonen for, at uploade dem til\n mediebiblioteket.\n ',
355358
uploadNotAllowed: 'Upload er ikke tiladt på denne lokation',
356-
disallowedMediaType: "Cannot upload this file, the media type with alias '%0%' is not allowed here",
357-
invalidFileName: 'Cannot upload this file, it does not have a valid file name',
358359
},
359360
member: {
360361
createNewMember: 'Opret et nyt medlem',

src/Umbraco.Web.UI.Client/src/assets/lang/en-us.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ export default {
376376
disallowedFileType: 'Cannot upload this file, it does not have an approved file type',
377377
disallowedMediaType: "Cannot upload this file, the media type with alias '%0%' is not allowed here",
378378
invalidFileName: 'Cannot upload this file, it does not have a valid file name',
379+
invalidFileSize: 'Cannot upload this file, it is too large',
379380
maxFileSize: 'Max file size is',
380381
mediaRoot: 'Media root',
381382
createFolderFailed: 'Failed to create a folder under parent id %0%',
@@ -1491,6 +1492,8 @@ export default {
14911492
preventCleanupDisableError: 'An error occurred while disabling version cleanup for %0%',
14921493
copySuccessMessage: 'Your system information has successfully been copied to the clipboard',
14931494
cannotCopyInformation: 'Could not copy your system information to the clipboard',
1495+
offlineHeadline: 'Offline',
1496+
offlineMessage: 'You are currently offline. Please check your internet connection.',
14941497
},
14951498
stylesheet: {
14961499
addRule: 'Add style',

src/Umbraco.Web.UI.Client/src/assets/lang/en.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ export default {
363363
disallowedFileType: 'Cannot upload this file, it does not have an approved file type',
364364
disallowedMediaType: "Cannot upload this file, the media type with alias '%0%' is not allowed here",
365365
invalidFileName: 'Cannot upload this file, it does not have a valid file name',
366+
invalidFileSize: 'Cannot upload this file, it is too large',
366367
maxFileSize: 'Max file size is',
367368
mediaRoot: 'Media root',
368369
createFolderFailed: 'Failed to create a folder under parent id %0%',
@@ -1495,6 +1496,10 @@ export default {
14951496
scheduleErrExpireDate2: 'The expire date cannot be before the release date',
14961497
preventCleanupEnableError: 'An error occurred while enabling version cleanup for %0%',
14971498
preventCleanupDisableError: 'An error occurred while disabling version cleanup for %0%',
1499+
offlineHeadline: 'Offline',
1500+
offlineMessage: 'You are currently offline. Please check your internet connection.',
1501+
onlineHeadline: 'Online',
1502+
onlineMessage: 'You are now online. You can continue working.',
14981503
},
14991504
stylesheet: {
15001505
addRule: 'Add style',

src/Umbraco.Web.UI.Client/src/mocks/handlers/temporary-file/temporary-file.handlers.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
const { rest } = window.MockServiceWorker;
22
import { umbracoPath } from '@umbraco-cms/backoffice/utils';
3-
import type { PostTemporaryFileResponse } from '@umbraco-cms/backoffice/external/backend-api';
3+
import type {
4+
GetTemporaryFileConfigurationResponse,
5+
PostTemporaryFileResponse,
6+
} from '@umbraco-cms/backoffice/external/backend-api';
47
import { UmbId } from '@umbraco-cms/backoffice/id';
58

69
const UMB_SLUG = 'temporary-file';
@@ -15,4 +18,16 @@ export const handlers = [
1518
ctx.text<PostTemporaryFileResponse>(guid),
1619
);
1720
}),
21+
22+
rest.get(umbracoPath(`/${UMB_SLUG}/configuration`), async (_req, res, ctx) => {
23+
return res(
24+
ctx.delay(),
25+
ctx.json<GetTemporaryFileConfigurationResponse>({
26+
allowedUploadedFileExtensions: [],
27+
disallowedUploadedFilesExtensions: ['exe', 'dll', 'bat', 'msi'],
28+
maxFileSize: 1468007,
29+
imageFileTypes: ['jpg', 'png', 'gif', 'jpeg', 'svg'],
30+
}),
31+
);
32+
}),
1833
];

src/Umbraco.Web.UI.Client/src/packages/core/manifests.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { manifests as propertyTypeManifests } from './property-type/manifests.js
1919
import { manifests as recycleBinManifests } from './recycle-bin/manifests.js';
2020
import { manifests as sectionManifests } from './section/manifests.js';
2121
import { manifests as serverFileSystemManifests } from './server-file-system/manifests.js';
22+
import { manifests as temporaryFileManifests } from './temporary-file/manifests.js';
2223
import { manifests as themeManifests } from './themes/manifests.js';
2324
import { manifests as treeManifests } from './tree/manifests.js';
2425
import { manifests as workspaceManifests } from './workspace/manifests.js';
@@ -47,6 +48,7 @@ export const manifests: Array<UmbExtensionManifest | UmbExtensionManifestKind> =
4748
...recycleBinManifests,
4849
...sectionManifests,
4950
...serverFileSystemManifests,
51+
...temporaryFileManifests,
5052
...themeManifests,
5153
...treeManifests,
5254
...workspaceManifests,

src/Umbraco.Web.UI.Client/src/packages/core/notification/layouts/default/notification-layout-default.element.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
ifDefined,
77
nothing,
88
css,
9+
styleMap,
910
} from '@umbraco-cms/backoffice/external/lit';
1011
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
1112
import type { UmbNotificationDefaultData, UmbNotificationHandler } from '@umbraco-cms/backoffice/notification';
@@ -23,7 +24,7 @@ export class UmbNotificationLayoutDefaultElement extends LitElement {
2324
override render() {
2425
return html`
2526
<uui-toast-notification-layout id="layout" headline="${ifDefined(this.data.headline)}" class="uui-text">
26-
<div id="message">${this.data.message}</div>
27+
<div id="message" style=${styleMap({ whiteSpace: this.data.whitespace })}>${this.data.message}</div>
2728
${this.#renderStructuredList(this.data.structuredList)}
2829
</uui-toast-notification-layout>
2930
`;

src/Umbraco.Web.UI.Client/src/packages/core/notification/notification.context.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface UmbNotificationDefaultData {
1212
message: string;
1313
headline?: string;
1414
structuredList?: Record<string, Array<unknown>>;
15+
whitespace?: 'normal' | 'pre-line' | 'pre-wrap' | 'nowrap' | 'pre';
1516
}
1617

1718
/**

0 commit comments

Comments
 (0)