Compare commits

...
Author SHA1 Message Date
kjac ce421b787e Merge branch 'refs/heads/v17/dev' into v17/feature/blocks-segment-variation
# Conflicts:
#	tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/BlockListElementLevelVariationTests.Publishing.cs
2025-10-22 14:27:58 +02:00
Niels Lyngsø 298db76cb1 Merge branch 'release/17.0' into v17/dev 2025-10-22 11:55:14 +02:00
Niels Lyngsø 2248eeb03e update import 2025-10-22 11:54:50 +02:00
Niels LyngsøandGitHub f6df0c1828 Item Repository: Sort statuses by order of unique (#20603)
* utility

* ability to replace

* deprecate removeStatus

* no need to call this any longer

* Sort statuses and ensure not appending statuses, only updating them
2025-10-22 09:42:13 +00:00
Jacob Overgaard 44d52392b5 Merge branch 'release/17.0' into v17/dev 2025-10-22 09:50:45 +02:00
63ae29a1aa Preview: Fixes a potential issue where the preview URL could be a different backoffice host (#20591)
* hotfix: ensures that local urls stay relative so we land up on the correct backoffice host that the user initiated the preview session from originally

* feat: since ensureAbsoluteUrl is never supplied anymore, we can remove the parameter altogether

* Remove unused dependency

* Expose IsExternal for URLs

* feat: adds localize controller

* chore: generates api models

* feat: marks the internal preview default url as relative, so that the `<base>` tag is taken into consideration - that way the URL will open on whatever host is active

* Remove IsExternal from the API again

* regenerate types

---------

Co-authored-by: kjac <kja@umbraco.dk>
2025-10-22 07:48:55 +00:00
Mads RasmussenandGitHub 6effe32136 Document Recycle Bin: Fix missing item name when restoring (#20599)
allow to pass in a item data resolver
2025-10-21 20:46:16 +02:00
leekelleher 4717264e10 Merge branch 'release/17.0' into v17/dev
# Conflicts:
#	src/Umbraco.Web.UI.Client/src/packages/core/recycle-bin/entity-action/restore-from-recycle-bin/restore-from-recycle-bin.action.ts
#	tests/Umbraco.Tests.AcceptanceTest/package-lock.json
#	tests/Umbraco.Tests.AcceptanceTest/package.json
2025-10-21 16:11:22 +01:00
f0ac7b4a50 Document/Media Recycle Bin: Add 'Trashed' state to info workspace view (#20581)
* Add 'Trashed' state to document workspace view

Introduces a new 'Trashed' label and tag for documents in the workspace view. Updates localization to include the 'Trashed' term for improved clarity when displaying trashed documents.

* Show trashed state in media workspace info view

---------

Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com>
2025-10-21 15:51:28 +02:00
5f0122e18b Make Create Actions open as dialogs (part 2) (#20523)
* open script create options as a dialog instead of sidebar

* align and simplify the blueprint dialog options

* debounce loadCollection calls

* update document collection context

* update media collection context

* Updated tests

* Bumped test helpers

* Revert "debounce loadCollection calls"

This reverts commit 1c15dda08d.

* Revert "update document collection context"

This reverts commit 47d74a8f5d.

* Revert "update media collection context"

This reverts commit f2eb1f22c1.

* align create dialog texts

* fix indention

* Bumped version of test helpers

---------

Co-authored-by: Andreas Zerbst <andr317c@live.dk>
Co-authored-by: Andreas Zerbst <73799582+andr317c@users.noreply.github.com>
2025-10-21 15:24:52 +02:00
Jacob OvergaardandGitHub de5a9ca5af Preview: Replaces WebSocket with the SignalR library to improve connectivity in the preview window (#20585)
* feat: replaces manual WebSocket with the actual SignalR library on the preview context

* feat: informs the developer what went wrong in preview mode

* feat: awaits the stop connection before proceeding

* feat: ensures no existing connection exists
2025-10-21 13:20:17 +00:00
Kenn JacobsenandGitHub 58068d1aa7 Rendering: Explicitly contextualize variation context for language fallback (closes #20350) (#20587)
Expliticly contextualize variation context for language fallback rendering
2025-10-21 14:41:29 +02:00
5f1c65e7ea User group: permissions grouping (#20584)
* clean up

* localizations

* group user permission by entity type

* adjustments

* fix lint errors

* Support granular permissions without entity type

Updated granular permission handling to allow permissions that are not tied to a specific entity type. Adjusted rendering logic and manifest interface to support undefined or empty forEntityTypes, and added UI for displaying ungrouped granular permissions.

* revert for now

---------

Co-authored-by: Mads Rasmussen <madsr@hey.com>
Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com>
2025-10-21 12:10:41 +00:00
Laura NetoandGitHub 20eedda4c7 Template: Update dotnet project template to remove previous LTS checks (#20573)
* Remove now unnecessary LTS checks from project dotnet template

* Update the starter kit versions
2025-10-21 13:12:25 +02:00
1099332edb Fixes broken integration test for v17 release (#20582)
Fixes broken integration test

Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>
2025-10-21 10:42:22 +00:00
Andy ButlandandLaura Neto 3a83e4a494 Publishing: Resolve exceptions on publish branch (#20464)
* Reduce log level of image cropper converter to avoid flooding logs with expected exceptions.

* Don't run publish branch long running operation on a background thread such that UmbracoContext is available.

* Revert to background thread and use EnsureUmbracoContext to ensure we can get an IUmbracoContext in the URL providers.

* Updated tests.

* Applied suggestion from code review.

* Clarified comment.
2025-10-21 12:22:50 +02:00
Andy ButlandandLaura Neto af3b17243b Media: Fixes SQL error to ensure database relation between user group media start folder and deleted media item is removed (closes #20555) (#20572)
Fixes SQL error to ensure database relation between user group media start folder and deleted media item is removed.
# Conflicts:
#	src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MediaRepository.cs
2025-10-21 11:42:19 +02:00
d05add4e1f Tiptap RTE: Allow removal of unregistered extensions (#20571)
* Tiptap toolbar config: enable removal of unregistered extensions

* Tiptap statusbar config: enable removal of unregistered extensions

* Tiptap toolbar config: Typescript tidy-up

* Tiptap toolbar sorting amend

Removed the need for the `tiptap-toolbar-alias` attribute,
we can reuse the `data-mark`.

* Tiptap extension config UI amend

If the extension doesn't have a `description`,
then add the `alias` to the title/tooltip, to give a DX hint.

* Tiptap toolbar: adds `title` to placeholder skeleton

* Added missing `forExtensions` for Style Select and Horizontal Rule toolbar extensions

* Update src/Umbraco.Web.UI.Client/src/packages/tiptap/property-editors/toolbar-configuration/property-editor-ui-tiptap-toolbar-configuration.element.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Umbraco.Web.UI.Client/src/packages/tiptap/property-editors/statusbar-configuration/property-editor-ui-tiptap-statusbar-configuration.element.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-21 10:43:52 +02:00
Andy Butlandandmole 68d1b9481a Hybrid Cache: Resolve start-up errors with mis-matched types (#20554)
* Be consistent in use of GetOrCreateAsync overload in exists and retrieval.
Ensure nullability of ContentCacheNode is consistent in exists and retrieval.

* Applied suggestion from code review.

* Move seeding to Umbraco application starting rather than started, ensuring an initial request is served.

* Tighten up hybrid cache exists check with locking around check and remove, and use of cancellation token.

(cherry picked from commit 81a8a0c191)
2025-10-21 09:59:49 +02:00
Laura NetoandGitHub e6f48799a1 Property Editors: DateTimeWithTimeZone - Changing timezone mode to Local shows invalid time zone error (#20526)
* Store local time zone as UTC and do not throw validation error when stored time zone is different

* Additional fixes when switching between date time editors with and without time zone

* Additional fixes

* Ensure that an update is triggered when the expected value does not match the stored value

This will happen when switching between editors (with and without time zone) or switching between a specific time zone to the editor's local time zone.

* Fix inconsistencies with null and undefined

* Fix inconsistencies between date/time provided to the client and returned in the value converter (when switching between editors)

* Fix unit tests and small bug

* Adjust integration test

* Small improvement

* Update test data

* Adjust logic so that time zone offsets are updated every time the date value changes

* Do not pre-select time zone when switching between unspecified and time zone editors
2025-10-21 09:29:46 +02:00
dependabot[bot]andJacob Overgaard 1efdde2473 Bump vite from 7.1.9 to 7.1.11 in /src/Umbraco.Web.UI.Client
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 7.1.9 to 7.1.11.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v7.1.11/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 7.1.11
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-21 09:14:05 +02:00
Mads RasmussenandGitHub c666c00ac5 Document/Media Recycle Bin: Add missing root workspace views (#20494) (#20569)
* add document recycle bin root workspace

* add media recycle bin root workspace

* export consts
2025-10-20 16:42:52 +02:00
Mads RasmussenandGitHub 94692cccb7 Document/Media Recycle Bin: Show full breadcrumb (#20547)
* register structure context for recycle bin

* Update manifests.ts

* export consts

* move href construction to context + override for document and media
2025-10-20 13:43:10 +02:00
Lee Kelleherandleekelleher ab4be79da0 Preview: Redirect to published URL on exit (#20556)
* Preview Exit: Gets the page's published URL on exit for redirect

* Preview Open Website: Uses the page's published URL

* Tweaked the published URL logic

* Code amends based on @copilot's suggestions

(cherry picked from commit d5a2f0572e)
2025-10-20 10:55:08 +01:00
Andy ButlandandGitHub a808e3ab46 Added direct dependency to secure version of Microsoft.Build.Tasks.Core in Umbraco.Web.UI (#20546)
Added direct dependency to secure version of Microsoft.Build.Tasks.Core in Umbraco.Web.UI.
2025-10-20 11:54:26 +02:00
Mads RasmussenandGitHub 92dbaf7162 Document/Media: Readonly when in recycle bin (#20541)
* make document and media readonly when trashed + reload the entity

* introduce restore event + remove readonly

* handle media audit log todos

* disable content type picker when trashed

* disable template picker when trashed
2025-10-17 17:49:05 +00:00
Kenn JacobsenandGitHub ae2c59b703 Make the indexing batch size configurable (#20543)
* Introduce configurable batch size for indexing

* Stop using Examine indexing events for reporting index rebuild operation completeness (it is volatile)
2025-10-17 15:45:03 +02:00
Andy Butland 72d44decd4 Update OpenApi.json and client-side models. 2025-10-17 15:30:43 +02:00
Anders ReusandAndy Butland 7e7d9da144 Added trashed state so when requesting content from the recycle bin via the management api it will return trashed instead of published state (#20542)
Added trashed state so when requesting content from the recycle bin via the management api, the state will be trashed instead of published.
2025-10-17 15:22:11 +02:00
Andy Butland b142dcc84f Merge branch 'main' into v17/dev 2025-10-17 15:20:55 +02:00
Andy Butland 8b1f18699d Update OpenApi.json and client-side models. 2025-10-17 15:20:01 +02:00
Lee KelleherandJacob Overgaard f82c0a90e7 UFM: Adds $index support to Block editors (fixes #20470) (#20488)
* Block List: adds `$index` support for UFM labels

* Block Grid: adds `$index` support for UFM labels

* Block RTE: adds `$index` support for UFM labels

Which is always zero `0`.
But has been wired up if we do implement the index order in future.
2025-10-17 15:03:21 +02:00
Andy Butland 5278b67f60 Merge branch 'main' into v17/dev 2025-10-17 14:41:06 +02:00
Andy ButlandandGitHub 65798b5722 Templates: Retain layout from file when loading template (closes #20524) (#20529)
Retain layout from file when loading template.
2025-10-17 10:46:54 +02:00
Jacob Overgaard 7d0adc4755 build(deps): bumps @umbraco-ui/uui from 1.16.0-rc.0 to 1.16.0 2025-10-17 10:36:38 +02:00
Andreas ZerbstandGitHub 11bf60a67c E2E: Updated exisiting acceptance tests to match updates from front end (#20525)
* Updated tests

* E2E: Updated acceptance tests to match changes (#20493)

* Updated tests to match changes

* More updates

* Bumped version

* Reverted change
2025-10-17 09:37:44 +02:00
Andy Butland de0503d90c Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Infrastructure/PropertyEditors/BlockEditorPropertyValueEditor.cs
2025-10-16 21:12:57 +02:00
4a504e8c95 Extensions: Adds @provideContext and @consumeContext decorators for a better developer experience (#20510)
* feat: adds first draft of a context consume decorator

* feat: uses an options pattern

* feat: changes approach to use `addInitializer` and `queueMicroTask` instead

* feat: adds extra warning if context is consumed on disconnected controllers

* feat: example implementation of consume decorator

* feat: adds support for 'subscribe'

* feat: initial work on provide decorator

* docs: adds license to consume decorator

* feat: adds support for umbraco controllers with `hostConnected`

* feat: uses asPromise to handle one-time subscription instead

* test: adds unit tests for consume decorator

* feat: adds support for controllers through hostConnected injection

* feat: adds support for controllers through hostConnected injection

* test: adds unit tests for provide decorator

* docs: adds more documentation around usage and adds a few warnings in console when it detects wrong usage

* feat: removes unused controllerMap

* docs: adds wording on standard vs legacy decorators

* docs: clarifies usage around internal state

* feat: adds proper return types for decorators

* docs: adds more types

* feat: makes element optional

* feat: makes element optional

* feat: uses @consume in the log viewer to showcase

* chore: cleans up debug info

* feat: renames to `consumeContext` and `provideContext` to stay inline with our own methods

* chore: removes unneeded typings

* chore: removes not needed check

* chore: removes not needed check

* test: adds test for rendered value

* feat: splits up code into several smaller functions

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* docs: augments code example for creating a context

* Update src/Umbraco.Web.UI.Client/src/packages/log-viewer/workspace/views/search/components/log-viewer-search-input.element.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-16 15:38:26 +01:00
Engiber LozadaandGitHub 271edb5214 News Dashboard: split into card + container, parent handles the data from the repo (#20503)
* Made card element it is own reusable component and passing the data as property.

* Created the umb-news-container element to handle all the priority grouping.

* Added hover styles to normal-priority cards.

* Removed unused variable.
2025-10-16 12:55:43 +00:00
Mads RasmussenandGitHub 8beb7f2acc Collection menu item extension point (#20506)
* add extension option for collection menu item

* Add collection menu module export

* remove unused css

* register user collection menu item

* register user collection menu

* use collection modal for user picker

* Delete user-picker-modal.element.ts

* Update manifests.ts

* explicit exports to avoid name collision

* hack to avoid circular dependency

* fix lint errors

* fix missing const export

* Update collection-menu-item.element.ts
2025-10-16 12:57:15 +01:00
498754e170 Explicitly flush isolated caches by key for content updates (#20519)
* Explicitly flush isolated caches by key for content updates

* Apply suggestions from code review

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
2025-10-16 10:56:32 +00:00
Andreas ZerbstandGitHub ae73fb3431 E2E: Updated acceptance tests to match changes (#20493)
* Updated tests to match changes

* More updates

* Bumped version

* Reverted change
2025-10-16 09:24:56 +00:00
Andy ButlandandGitHub 3830d75413 Obsolete GetAtRoot on DocumentCache (#20514)
Obsolete GetAtRoot on DocumentCache.
2025-10-16 08:23:20 +02:00
Andy Butland f1f2f702c0 Restored and obsoleted removed extension method AsEnumerableOfOne. 2025-10-15 20:22:58 +02:00
Andy Butland c5c417d08e Merge branch 'release/17.0' into v17/dev 2025-10-15 20:13:08 +02:00
2503cabbce Dependencies: Update to .NET 10 RC 2 (#20508)
* Update to .NET 10 RC 2.

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-15 20:12:11 +02:00
Niels Lyngsø cee163ae1f Merge branch 'release/17.0' into v17/dev 2025-10-15 14:13:47 +02:00
Niels Lyngsø 7e8a7f0b40 Cherry picked 4c05a114c5 2025-10-15 14:11:25 +02:00
Niels LyngsøandGitHub 126c8a56d5 variant selector: hint badge should render in append slotfor the variant selector (#20504)
ensure variant-selector badge gets rendered at the right spot
2025-10-15 09:29:49 +00:00
Niels LyngsøandGitHub 6be5a8cf35 Merge branch 'v17/dev' into v17/feature/blocks-segment-variation 2025-10-15 11:13:12 +02:00
Niels Lyngsø 2412c662df Merge branch 'release/17.0' into v17/dev
# Conflicts:
#	version.json
2025-10-15 10:23:39 +02:00
Andy Butland 99ea8b9087 Back Office: Fixes link to workspace root from breadcrumb trail (closes: #20455) (#20459)
Fixes link to workspace root from breadcrumb trail.
2025-10-15 10:12:58 +02:00
Andy Butland b25feac011 Merge branch 'main' into v17/dev 2025-10-15 10:12:28 +02:00
Andy Butland 86dda9f9b3 Content Types: Prevent creation of document type with an alias that case insensitively matches an existing alias (closes #20467) (#20471)
Prevent creation of document type with an alias that case insensitively matches an existing alias.
2025-10-15 09:49:32 +02:00
Andy Butland a95fd9f340 Merge branch 'main' into v17/dev 2025-10-15 09:48:05 +02:00
Nikolaj Geisle 9c082c613e bump version to beta2 2025-10-15 08:55:15 +02:00
Copilotandleekelleher 5af9df1871 UFM: Add camelCase aliases for UFM filters to support UFMJS expressions (closes #20500) (#20501)
* Initial plan

* Add camelCase aliases for UFM filters with hyphens (stripHtml, titleCase, wordLimit)

Co-authored-by: iOvergaard <752371+iOvergaard@users.noreply.github.com>

* Add manifest tests for camelCase filter aliases

Co-authored-by: iOvergaard <752371+iOvergaard@users.noreply.github.com>

* discards tests that are not useful

* test: updates imports for stripHtml api

* Exports `UmbUfmStripHtmlFilterApi` class

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: iOvergaard <752371+iOvergaard@users.noreply.github.com>
Co-authored-by: leekelleher <leekelleher@gmail.com>
(cherry picked from commit a19b9fb5fe)
2025-10-14 17:42:22 +01:00
Mads RasmussenandGitHub 12297ea617 Picker data source: Add support for pickable filters (#20491)
* add pickable to vs code dictionary

* set up types for pickable filters in data sources

* pass search pickable filter to search result

* apply filter config in document data source example

* add pickable filters to custom tree example

* Update input-entity-data.context.ts

* remove unused

* Update types.ts
2025-10-14 17:11:34 +01:00
Anders ReusandAndy Butland 3892670d92 Added culture to the ApiContentRouteBuilder to include variant languages. (#20366) (#20499)
Added culture to the ApiContentRouteBuilder to include variant languages.
2025-10-14 16:14:02 +02:00
Andy Butland 07d0d7d2ee Merge branch 'main' into v17/dev 2025-10-14 16:10:59 +02:00
Mads Rasmussen d9de69c40f fix import in storybook of moved file 2025-10-14 12:27:21 +02:00
Mads Rasmussen ac56bffef2 fix import in storybook of moved file 2025-10-14 12:26:25 +02:00
Sven GeusensandSven Geusens 49f3fc9993 Delivery API: Fix not reindexing branch descendants when branch root already published but unchanged (closes #20370) (#20462)
* Fix deliveryApi not reindexing branch descendants when branch root already published and unchanged

* Commit update and name improvement
2025-10-14 12:18:26 +02:00
Sven Geusens 068183ac35 Merge branch 'main' into v17/dev 2025-10-14 12:17:06 +02:00
7f1cdf8ef5 Auhorization: Cherrypicked integration tests from V15 (#20492)
* V15 QA Added the authorization integration tests (#18419)

* Added authorization integration tests

* Removed unnecessary tests and update tests for preview controller

* Updated to use the newest changes from v15/dev and added an override for the AuthenticateClientAsync to use the userGroupKey

* Updated CompatibilitySuppressions to include changes from integration tests

* Updated pipelines

* Skips managementApi tests

* Only run necessary tests

* Added new schema per fixture to reduce test setup time

* Fixed failing tests

* Updated test setup

* Updated test

* Added suppression

* Fixed failing tests

* Updated addOnTeardown methods to protected

* Added method for clearing the host

* Added teardown

* Updated model usage

* Added a lot of cleanup for memory leak issues when running tests

* Added CompatibilitySuppressions.xml

* Updated tests

* Cleaned up

* Adjusted base classes

* Updated pipeline

* Updated CompatibilitySuppressions.xml

* Updated test logging

* Fixed reponse

* Updated condition to skip tests

* Updated tests, not done

* Reworked test to expect correct responses with correct setup

* Updated tests

* More updates to tests

* Updated tests

* Cleaned up tests

* Updated setup

* Cleaned up tests to match setup

* Cleaned up setup

* Removed suppression

* Fixed tests

* Move order of checks

* Fix naming

* Formatting

* Dispose of host

* Keep track of if we're disposed

* Compat suppression

* Dont dispose

* Fix failing tests

* removed unused virtual

* Updated CompatibilitySuppressions.xml

---------

Co-authored-by: Andreas Zerbst <andr317c@live.dk>
Co-authored-by: Zeegaan <skrivdetud@gmail.com>
Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
# Conflicts:
#	tests/Umbraco.Tests.Integration/CompatibilitySuppressions.xml
#	tests/Umbraco.Tests.Integration/ManagementApi/ManagementApiTest.cs
#	tests/Umbraco.Tests.Integration/ManagementApi/Policies/AllCultureControllerTests.cs
#	tests/Umbraco.Tests.Integration/ManagementApi/Policies/CreateDocumentTests.cs
#	tests/Umbraco.Tests.Integration/ManagementApi/Policies/UpdateDocumentTests.cs
#	tests/Umbraco.Tests.Integration/ManagementApi/Preview/EndPreviewTests.cs
#	tests/Umbraco.Tests.Integration/ManagementApi/Preview/EnterPreviewTests.cs
#	tests/Umbraco.Tests.Integration/TestServerTest/UmbracoTestServerTestBase.cs

* Updated test

* Updates

* Removed unnessecary test

---------

Co-authored-by: Nhu Dinh <150406148+nhudinh0309@users.noreply.github.com>
Co-authored-by: Zeegaan <skrivdetud@gmail.com>
Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
2025-10-14 10:04:10 +00:00
Andy ButlandandZeegaan 37b239b8ca Performance: Reduce number of database calls in save and publish operations (#20485)
* Added request caching to media picker media retrieval, to improve performance in save operations.

* WIP: Update or insert in bulk when updating property data.

* Add tests verifying UpdateBatch.

* Fixed issue with UpdateBatch and SQL Server.

* Removed stopwatch.

* Fix test on SQLite (failing on SQLServer).

* Added temporary test for direct call to NPoco UpdateBatch.

* Fixed test on SQLServer.

* Add integration test verifying the same property data is persisted as before the performance refactor.

* Log expected warning in DocumentUrlService as debug.

(cherry picked from commit 12adfd52bd)
2025-10-14 11:29:24 +02:00
Laura Neto ea44850804 Dependencies: Remove Microsoft.CodeAnalysis.CSharp dependency from Umbraco.Infrastructure (#20481)
* Remove Microsoft.CodeAnalysis.CSharp from Infrastructure project

This was only needed for runtime compilation and thus is no longer needed in Infrastructure.
It also caused dependency problems with EF Core Design in previous versions.

* Disable CPM for UI project to better reflect consumers

This will ensure that we face any potential dependency issues consumers are also likely to run into.

* Add `Microsoft.CodeAnalysis.CSharp` reference to `Umbraco.Cms.DevelopmentMode.Backoffice`
2025-10-14 09:49:46 +02:00
Laura Neto 4dbb4eb48b Merge branch 'main' into v17/dev
# Conflicts:
#	Directory.Packages.props
#	tests/Umbraco.Tests.AcceptanceTest/package-lock.json
#	tests/Umbraco.Tests.AcceptanceTest/package.json
2025-10-14 09:48:16 +02:00
Laura NetoandGitHub b5662d9c89 Dependencies: Remove Microsoft.CodeAnalysis.CSharp dependency from Umbraco.Infrastructure (#20481)
* Remove Microsoft.CodeAnalysis.CSharp from Infrastructure project

This was only needed for runtime compilation and thus is no longer needed in Infrastructure.
It also caused dependency problems with EF Core Design in previous versions.

* Disable CPM for UI project to better reflect consumers

This will ensure that we face any potential dependency issues consumers are also likely to run into.

* Add `Microsoft.CodeAnalysis.CSharp` reference to `Umbraco.Cms.DevelopmentMode.Backoffice`
2025-10-14 09:39:53 +02:00
Niels Lyngsø 4c42175ffc Merge branch 'release/17.0' into v17/dev
# Conflicts:
#	version.json
2025-10-14 08:54:54 +02:00
Mads RasmussenandGitHub 8be2d77006 Only register the Entity Data Picker when we have some registered Data Sources (#20484)
Add conditional registration for Entity Data Picker

Introduces an entry point for the Entity Data Picker property editor that registers its manifests only if picker data sources are present, preventing an unusable UI from appearing by default.
2025-10-13 20:56:07 +02:00
Niels LyngsøandGitHub a6eb2a1527 Modals: Make Create Actions open a Dialogs (#20489)
* generic create dialog

* document create dialog

* media create dialog

* member create

* partial view
2025-10-13 20:53:29 +02:00
11fcfba091 News dashboard: API and rendering of news stories on dashboard (#20416)
* Adding controller

* Lower case route to match other endpoints

* Adding service and typed output

* Renaming to NewsDashboard

* Moving more stuff to service

* Removing unused code

* Some refactoring in accordance with better architecture

* Created repository and mock data source for the news dashboard also display some data in the UI.

* Minor refactoring: naming, aligning with existing controller patterns.

* Update OpenApi.json.

* Update typed client sdk and types.

* Provide language to API endpoint, just in case we want to localize news in the future.

* Obsoleted configuration

* Moved mock data to mocks folder and updated repository to use the actual response model and service from the Api

* Prepared news repository with server data source.

* Rendered news items according to required group structure.
Added TODOs for remaining tasks.

* Fixed FE build issues.

* Update src/Umbraco.Core/Constants-Configuration.cs

* Fixed grid spacing, sanitize code and make the styles closer to the v13.

* Added container query and padding to the card body.

* Fix padding

* Fixed title according to priority.

* Relocated/renamed the news server data-source file

* Simplified the news repo/data-source classes

by extending `UmbControllerBase`, the host constructor is handled for us.

* Added `types.ts` export type files

* Refactored interface name + typing

* Added `uui-loader` component

* Tweaked styles, added box-shadow to cards

Added flexbox gap to the card body.

* Sorted import order

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: engjlr <enl@umbraco.dk>
Co-authored-by: leekelleher <leekelleher@gmail.com>
2025-10-13 20:27:07 +02:00
3393febdca News dashboard: API and rendering of news stories on dashboard (#20416)
* Adding controller

* Lower case route to match other endpoints

* Adding service and typed output

* Renaming to NewsDashboard

* Moving more stuff to service

* Removing unused code

* Some refactoring in accordance with better architecture

* Created repository and mock data source for the news dashboard also display some data in the UI.

* Minor refactoring: naming, aligning with existing controller patterns.

* Update OpenApi.json.

* Update typed client sdk and types.

* Provide language to API endpoint, just in case we want to localize news in the future.

* Obsoleted configuration

* Moved mock data to mocks folder and updated repository to use the actual response model and service from the Api

* Prepared news repository with server data source.

* Rendered news items according to required group structure.
Added TODOs for remaining tasks.

* Fixed FE build issues.

* Update src/Umbraco.Core/Constants-Configuration.cs

* Fixed grid spacing, sanitize code and make the styles closer to the v13.

* Added container query and padding to the card body.

* Fix padding

* Fixed title according to priority.

* Relocated/renamed the news server data-source file

* Simplified the news repo/data-source classes

by extending `UmbControllerBase`, the host constructor is handled for us.

* Added `types.ts` export type files

* Refactored interface name + typing

* Added `uui-loader` component

* Tweaked styles, added box-shadow to cards

Added flexbox gap to the card body.

* Sorted import order

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: engjlr <enl@umbraco.dk>
Co-authored-by: leekelleher <leekelleher@gmail.com>
2025-10-13 18:20:01 +00:00
Niels Lyngsø 28e4caaad3 fix merge gone wrong 2025-10-13 18:42:06 +02:00
Mads RasmussenandGitHub d6b9eb61b2 Entity data picker: Hide tree root (#20473)
Change tree root visibility in entity data picker
2025-10-13 06:44:11 +00:00
Bjarne FyrstenborgandAndy Butland 0367e56db6 UX: Center align log type in media history view (#20469)
Center align log type in media
2025-10-13 06:35:24 +02:00
Andy Butland e28153f004 Merge branch 'main' into v17/dev 2025-10-13 06:34:47 +02:00
Mads RasmussenandGitHub 2ce6c8f8c8 Make data source field mandatory, when supported, in data type details (#20463)
Make data source field mandatory in data type details
2025-10-12 17:52:35 +00:00
fd1c9f1673 Refactoring: Fixed spelling mistake in method name (#20460)
* Fixed spelling mistake in method name.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-10 15:06:49 +02:00
Andy Butland 2c284a702a Merge branch 'main' into v17/dev 2025-10-10 15:06:11 +02:00
Mads RasmussenandGitHub c68a26cb5f Input Entity Data Picker: wire up client validation (#20456)
trigger client validation if the amount configuration is not met
2025-10-10 14:47:39 +02:00
c037323910 PropertyType workspace: layout & labeling adjustments (#20131)
* Property workspace update

* Fixed error with updating the properties

* Unused variable

* Added data-mark to description textarea

* make select 100% width

* tiny appearance-option style adjustments

* Make placeholder property inside the input-with-alias optional

* Moving variations and member type option to their own boxes

---------

Co-authored-by: Mads Rasmussen <madsr@hey.com>
Co-authored-by: Niels Lyngsø <nsl@umbraco.dk>
Co-authored-by: Niels Lyngsø <niels.lyngso@gmail.com>
2025-10-10 12:37:26 +02:00
f60436270f Property Editor Data Source (#20375)
* Add property editor data source extension types

Introduces types and extension interfaces for property editor data sources, including manifest and API definitions. Updates the main property-editor types export to include the new data source types.

* add test data sources

* wip collection and item repos

* export consts

* fix picker modal token

* make global components file

* render picker in data type

* wire up repositories

* append editor data source alias to data type detail model

* fix global manifest declaration

* make optional

* fix types

* register collection item picker modal element + wip collection menu extension

* register collection menu for property editor data source

* wire up modal tokens

* fix circular

* register as global element

* register default kind for collection menu

* wip fleshing out collection menu

* pass props + listen for selection events

* fix imports

* accept icon in manifest

* extend base type

* use correct data to calculate length

* export types

* add load more button

* wire up load more

* remove debugger

* add search for property editor data sources

* only select one data source

* rename file

* add entity type

* add manifest for search result item

* fix imports/exports

* fix manifest imports

* wire up data source value with workspace

* remove debugger

* wip property editor + input

* move data-source files

* more specific extension types

* remove copy from file name

* allow settings in manifests

* export types

* merge settings

* fix ui alias

* remerge if data source is removed

* Update data-type-details-workspace-view.element.ts

* reset data

* Update data-type-workspace.context.ts

* update merging + move mapping to data source

* Fix mutation of data.values in data type detail mapping

Refactored #mapServerResponseModelToEntityDetailModel to avoid mutating the original data.values array when removing the editorDataSourceAlias. This ensures the original server response remains unchanged and improves data integrity.

* add  forDataSourceTypes to manifest

* update interfaces

* test data source implementations

* only show data source select if property editor supports it

* remove custom context

* remove unused token

* use generic collection item picker modal

* remove custom modal

* export types

* render data source alias on data type into view

* pass data source alias

* allow data source alias

* allow data source alias

* pass data source alias

* add prop for data source alias

* Add property editor data source alias support

* Add editor data source alias to property context

Introduces support for storing and retrieving the editor data source alias in UmbPropertyContext. Updates UmbPropertyElement to use the context for managing the data source alias and ensures the alias is set on the property editor element.

* pass data source alias to input

* pass data source alias to context

* update js docs

* split types from token file

* fix import

* update error message

* add more test sources

* Refactor repository manager initialization logic

Changed the initialization flow in UmbRepositoryItemsManager to support optional repository alias and deferred repository setup. Added setItemRepository and getItemRepository methods for explicit repository management, and moved repository initialization logic to a dedicated private method.

* remove support for passing a filter

* wip wire up input with modal

* add constant

* test user data source

* add todo

* require entityType on webhook items

* add entityType

* use id as unique

* add default icon

* wire up search

* add search to media

* pass config

* support configuration in data sources + temp test cases

* remove temp text

* change to one generic extension type with a data type sub type

* search in label

* pass filter args to collection item picker

* clean up

* aligning interfaces

* iterate status instead of item

* simplify examples

* add types for config

* move to examples

* add custom data examples for collection and tree

* update imports

* add manifests for collection and tree custom data examples

* add type guards

* add type guards

* Update types.ts

* add return type

* remove debuggers

* make observables optional

* add null checks for observables

* use statuses

* extend picker input context

* map config

* use data to set value when there is no observable

* store as string array

* Add getDefaultApiConstructor to tree item element

* make it optional

* fix search types

* add fallback icon and name

* remove unused imports

* pass stored value to input

* rename file

* remove unused config value

* make api observable

* add search to custom collection example

* render fallback item

* fix import order

* add fallback render to tree item element

* Update tree-item.element.ts

* Revert "Update tree-item.element.ts"

This reverts commit 3458877de9.

* Revert "add fallback render to tree item element"

This reverts commit b30219d3ed.

* move from data type to property editor

* align file names

* introduce picker-property-editor module

* remove custom types

* use basic types

* use tree item type

* Update input-entity-data.context.ts

* update types

* add interface for item model

* force unique on collection item model

* require an item model in picker context

* allow icon to be null

* extend item model from user group item model

* add entity type to mapped data

* Update user-group-item.server.data-source.ts

* align static file models

* correct types for user picker

* extend item model

* fix types

* more type fixing

* align models

* align models

* fix types

* add utils for fallback name and icon

* add todo

* use fallback name and icon functions

* Update default-picker-search-result-item.element.ts

* add fallback tree item if none is registered

* add search to example

* extract data source config and pass to api

* align naming

* temp type cast

* move search module into core

* fix illegal imports

* add missing const exports

* make property-editor-data-source module

* register property editor data source ref item + render description

* remove console log

* remove indention

* simplify data source type

* Update src/Umbraco.Web.UI.Client/src/packages/property-editors/entity-data-picker/input/input-entity-data.element.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Umbraco.Web.UI.Client/src/packages/core/property-editor-data-source/input/input-property-editor-data-source.element.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Umbraco.Web.UI.Client/src/packages/core/collection/menu/default/default-collection-menu.element.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* add todo

* hide add button when readonly

* check correct amount config

* Update input-entity-data.element.ts

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-10 09:46:48 +00:00
Bjarne FyrstenborgandAndy Butland 9b0b60e6cb Icon Picker: Fit icons scroll container to modal height (#20438)
* Fill height and align icons to top

* Auto scrollbar instead

* Auto height of grid rows

* Enforce scroll again
2025-10-10 10:33:21 +02:00
Andy Butland 0996891c5c Merge branch 'main' into v17/dev 2025-10-10 10:32:45 +02:00
Andy Butland 7a48c11ddd Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Infrastructure/Security/IdentityMapDefinition.cs
2025-10-10 09:54:19 +02:00
leekelleher de449079dd Fixed build error 2025-10-10 08:43:32 +01:00
leekelleher 10bcf5ba72 Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item/tree-item-base/tree-item-element-base.ts
2025-10-10 08:20:55 +01:00
Andy Butland 5f14365470 Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Infrastructure/Mail/EmailSender.cs
2025-10-09 15:41:26 +02:00
Laura NetoandAndy Butland f539a27a19 Migrations: Adjust the JsonBlockValueConverter to handle conflicts with 'values' property (#20429)
* Adjust the `JsonBlockValueConverter` to handle conflicts with 'values' property (due to old data schema)

* Simplify code

* Add unit test to verify change.

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
2025-10-09 10:17:20 +02:00
Laura Neto 296858c1ca Merge branch 'main' into v17/dev
# Conflicts:
#	templates/UmbracoProject/.template.config/template.json
2025-10-09 09:51:31 +02:00
Nikolaj Geisle 832bd7eb61 bump version to beta 2025-10-09 08:58:24 +02:00
Andy ButlandandGitHub 64836e0b7a Update version from 17.0.0-rc to 17.1.0-rc 2025-10-09 08:54:36 +02:00
d6ce8d91a9 PropertyType workspace: layout & labeling adjustments (#20131)
* Property workspace update

* Fixed error with updating the properties

* Unused variable

* Added data-mark to description textarea

* make select 100% width

* tiny appearance-option style adjustments

* Make placeholder property inside the input-with-alias optional

* Moving variations and member type option to their own boxes

---------

Co-authored-by: Mads Rasmussen <madsr@hey.com>
Co-authored-by: Niels Lyngsø <nsl@umbraco.dk>
Co-authored-by: Niels Lyngsø <niels.lyngso@gmail.com>
2025-10-08 18:24:58 +00:00
Nikolaj Geisle fb91ade164 Merge branch 'main' into v17/dev 2025-10-08 19:18:04 +02:00
Niels Lyngsø 38a9a79c75 Merge branch 'main' into v17/dev 2025-10-08 17:23:48 +02:00
Niels Lyngsø 924b1446e3 Merge branch 'main' into v17/dev 2025-10-08 16:37:50 +02:00
Niels LyngsøandGitHub 2e0d006a6c Single Block property editor (#20414)
* single block property editor

* clean up

* auto create a block as part of rendering
2025-10-08 13:02:15 +00:00
d9f8faf509 Load balancing: Load balance isolated caches to allow the backoffice to be load balanced (#20417)
* V16:  Cache Version Mechanism (#19747)

* Add RepositoryCacheVersion table

* Add repository

* Add Cache version lock

* Add GetAll method to repository

* Add RepositoryCacheVersionService

* Remember to add lock in data creator

* Work my way out of constructor hell

This is why we use DI folks. 🤦

* Add checks to specific cache policies

* Fix migration

* Add to schema creator

* Fix database access

* Initialize the cache version on in memory miss

* Make cache version service internal

* Add tests

* Apply suggestions from code review

Co-authored-by: Andy Butland <abutland73@gmail.com>

* Add missing obsoletions

* Prefer full name

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>

* fixed merge

* V16/feature/move last synced id to db (#19884)

* Foundation work for moving last synced id

* register manager and repo in dependency injection

* Fixing to make tests work

* Replacing the use of the old LastSyncedFileManager.cs with the new LastSyncedManager.cs

* Testing to delete out of sync id and old entries

* changing some stuff to please the reviewer.

* Inverted saving methods id check and fixed documentation mishaps

* Loadbalancing: Add Cache Sync service to allow us to roll forward isolated caches when backoffice is load balanced. (#20398)

* Split cache refreshers into internal and external caches

* Add obsolete constructor for CacheInstructionsPruningJob

* Add xml docs

* Move lastID management into CacheInstructionService

* Cache last synced ids in memory

* Lock when processing instructions

* Sync caches when out of sync

* Fix constructors for ICacheSyncService

* Cache version on request

* Register caches as synced when instructions are processed

* Rename CacheVersionAccessor to IRepositoryCacheVersionAccessor

* Set caches as synced before actually syncing the caches

* Set caches as synced before syncing, within scope, this should also lock the cache version from being written to whilst updating caches

* Only check version for backoffice requests

* Clear request cache when caches are syned

* Default to using NOOP cache version service

* Don't generate local identity in database server messenger anymore

* Fix ambiguous constructor

* Add helper method to switch to load balanced isolated caches

* Fix LastSyncedManagerTests

* Fix RepositoryCacheVersionServiceTests

* Fix DefaultCachePolicyTests

* Use correct constructor in FullDataSetRepositoryCachePolicy

* Minor cleanup

* Add XML docs

* Add more xml docs

* Apply suggestions from code review

Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>

---------

Co-authored-by: Zeegaan <skrivdetud@gmail.com>
Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>

* Fix migration plan

* fix tests

* Fix integration tests

* Fix changes from github review

* Move premigrations to v17

* Make lock constantws sequential

* Fix comment

* Make IRepositoryCacheVersionService and ICacheSyncService protected on EntityRepositoryBase

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Nicklas Kramer <nik@umbraco.dk>
Co-authored-by: NillasKA <kramernicklas@gmail.com>
Co-authored-by: Zeegaan <skrivdetud@gmail.com>
Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
2025-10-08 14:55:50 +02:00
Mads Rasmussen 5eaf7fdb90 Update document-tree.server.data-source.ts 2025-10-08 13:27:58 +02:00
Mads Rasmussen 0dcb10ad41 Merge branch 'main' into v17/dev 2025-10-08 13:27:52 +02:00
leekelleher 15089b28bf Fixed failing UmbTreeItemActiveManager unit-test 2025-10-08 11:42:28 +01:00
ebe056df05 Collection: hide children of collection until active child (#20392)
* remove use of modals in collections

* add parent path to support absolute path generation

* add note

* make tree load more minimalistic

* set type and expand inherited styles

* also set title

* Update src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* create actions should not open as modal

* remove unused import

* fix router getActivePath

* make expand open the collection

* setTargetTakeSize to low when Collection parent

* expose typeUnique

* fix opening collection

* remove log

* active manager

* export

* impl active manager

* prepare for search param redirects

* fixed collapse feature

* set routes to undefined

* preserveQuery

* ensureSlash

* make a hard redirect for collections

* only if anscenstors are present in data.

* not full match anyway

* only forceShow on hasCollection

* remove umb-section-sidebar-context-menu

* rename to isMenu

* Update src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace-split-view.element.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/tree-item/document-tree-item.context.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-08 10:11:46 +00:00
Jacob Overgaard 54407a0687 add missing import (merge failure) 2025-10-08 11:27:04 +02:00
mole 787a5ccc2d Merge remote-tracking branch 'origin/main' into v17/dev 2025-10-08 10:45:16 +02:00
17a5477242 Serverside generated preview URLs (#20021)
* Serverside generated preview URLs

* Add URL provider notation to UrlInfo

* Change preview URL generation to happen at preview time based on provider alias

* Update XML docs

* Always add culture (if available) to preview URL

* Do not log user input (security vulnerability)

* Fix typo

* Re-generate TypeScript client

from Management API

* Deprecated `UmbDocumentPreviewRepository.enter()` (for v19)

Fixed TS errors

Added temp stub for `getPreviewUrl`

* Adds `previewOption` extension-type

* Adds "default" `previewOption` kind

* Relocated "Save and Preview" workspace action

reworked using the "default" `previewOption` kind.

* Added stub for "urlProvider" `previewOption` kind

* Renamed "workspace-action-default-kind.element.ts"

to a more suitable filename.

Exported element so can be reused in other packages,
e.g. documents, for the new "save and preview" feature.

* Refactored "Save and Preview" button

to work with first action's manifest/API.

* Reverted `previewOption` extension-type

Re-engineered to make a "urlProvider" kind for `workspaceActionMenuItem`.
This is to simplify the extension point and surrounding logic.

* Modified `saveAndPreview` Document Workspace Context

to accept a URL Provider Alias.

* Refactored "Save and Preview" button

to extend `UmbWorkspaceActionElement`.

This did mean exposing certain methods/properties to be overridable.

* Used `umbPeekError` to surface any errors to the user

* Renamed `urlProvider` kind to `previewOption`

* Relocated `urlProviderAlias` inside the `meta` property

* also throw an error

* Added missing `await`

* Fix build errors after forward merge

---------

Co-authored-by: leekelleher <leekelleher@gmail.com>
Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com>
Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>
2025-10-08 08:27:01 +02:00
Jacob Overgaard 74328e9496 Merge remote-tracking branch 'origin/main' into v17/dev 2025-10-08 08:19:56 +02:00
Andy Butland cd9dda2aad Merge branch 'main' into v17/dev 2025-10-08 06:29:30 +02:00
Niels Lyngsø 62efc2631e remove not existing umb-section-sidebar-context-menu 2025-10-07 22:56:46 +02:00
20de48a496 Load Balancing: Implement distributed background jobs (#20397)
* Start work

* Introduce dto

* Start making repository

* Add migrations

* Implement fetchable first job

* Fix up to also finish tasks

* Refactor jobs to distributed background jobs

* Filter jobs correctly on LastRun

* Hardcode delay

* Add settings to configure delay and period

* Fix formatting

* Add default data

* Add update on startup, which will update periods on startup

* Refactor service to return job directly

* Update src/Umbraco.Infrastructure/Services/Implement/DistributedJobService.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Umbraco.Infrastructure/BackgroundJobs/DistributedBackgroundJobHostedService.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Umbraco.Infrastructure/BackgroundJobs/DistributedBackgroundJobHostedService.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Remove unused

* Move jobs and make internal

* make OpenIddictCleanupJob.cs public, as it is used elsewhere

* Minor docstring changes

* Update src/Umbraco.Core/Persistence/Constants-Locks.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* ´Throw correct exceptions

* Update xml doc

* Remove business logic from repository

* Remove more business logic from repository into service

* Remove adding jobs from migration

* fix creation

* Rename to ExecuteAsync

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: mole <nikolajlauridsen@protonmail.ch>
2025-10-07 18:49:21 +02:00
f0cf4703fa Member type container in management API (#16914)
* Member type container in management API

* Fix naming

* Update service

* Fix services

* Register IMemberTypeContainerService in DI container

Added a new service registration for `IMemberTypeContainerService`
in the `AddCoreServices` method of `UmbracoBuilder.cs`.

* Replace auditRepository with auditService in constructor

* Add MemberTypeContainer to UdiEntityType mapping

---------

Co-authored-by: georgebid <91198628+georgebid@users.noreply.github.com>
Co-authored-by: Sebastiaan Janssen <sebastiaan@umbraco.com>
2025-10-07 15:31:35 +02:00
Jacob Overgaard 0cf8279e65 Merge branch 'main' into v17/dev 2025-10-07 14:52:10 +02:00
Lee KelleherandGitHub 2f712cab08 Refactors backoffice sections with default element and context API (#20305)
Refactors backoffice sections

using the extensions registry to set a default/fallback
element and API for the section.
2025-10-07 14:40:00 +02:00
Niels LyngsøandGitHub 034cf2894c Tree: Minimalistic styles for load more (#20376)
* make tree load more minimalistic

* set type and expand inherited styles

* also set title
2025-10-07 13:21:41 +01:00
Lee KelleherandGitHub 1498f3bdc6 Removed umb-media-picker-create-item component (#20403)
Remove `umb-media-picker-create-item` component

it was not being used internally.

There was previously an issue due to a routing issue,
(in that the Media Picker modal wasn't routed),
so the Media create workspace wouldn't work.
This could be resolved in future and see this feature return.
2025-10-07 14:20:02 +02:00
Mads RasmussenandGitHub 324e5bcb0a Fix: undefined document name when trashing an item (#20401)
* add interface for item data resolver

* export interface

* add interface to Document item data resolver implementation

* allow to pass a item data resolver to trash action

* pipe resolver to modal

* pass resolver to document trash manifest

* use resolver in modal when available
2025-10-07 11:26:44 +00:00
Kenn JacobsenandGitHub ba4a874fb4 Models Builder: Make Models Builder better at not performing "rude edits" (#20394)
Make Models Builder better at not performing rude edits
2025-10-07 12:47:26 +02:00
1f351244d4 Dependencies: Update server dependencies (#20385)
* Bump Azure.Identity from 1.13.2 to 1.16.0

* Bump BenchmarkDotNet from 0.14.0 to 0.15.4

* Bump Bogus from 35.6.3 to 35.6.4

* Bump HtmlAgilityPack from 1.12.1 to 1.12.4

* Bump MailKit from 4.11.0 to 4.14.0

* Bump MessagePack from 3.1.3 to 3.1.4

* Bump Microsoft.AspNetCore.Mvc.Testing from 9.0.4 to 9.0.9

* Bump Microsoft.Data.SqlClient from 6.0.1 to 6.1.1

* Bump Microsoft.Extensions.Caching.Hybrid from 9.8.0 to 9.9.0

* Bump Microsoft.Extensions.Logging.Debug from 9.0.4 to 9.0.9

* Bump Microsoft.NET.Test.Sdk from 17.13.0 to 18.0.0

* Bump ncrontab from 3.3.3 to 3.4.0

* Bump Nerdbank.GitVersioning from 3.7.115 to 3.8.118

* Bump OpenIddict packages from 6.2.1 to 7.1.0

* Bump Serilog from 4.2.0 to 4.3.0

* Bump Serilog.Sinks.File from 6.0.0 to 7.0.0

* Bump Swashbuckle.AspNetCore from 8.1.1 to 9.0.6

* Bump System.Data.Odbc from 9.0.4 to 9.0.9

* Bump System.Data.OleDb from 9.0.4 to 9.0.9

* Bump Microsoft.IdentityModel.JsonWebTokens from 8.8.0 to 8.14.0

* Bump SixLabors.ImageSharp.Web from 3.1.5 to 3.2.0

- Implicit global usings were made opt-in (https://github.com/SixLabors/ImageSharp.Web/pull/391)

* Bump NJsonSchema from 11.0.2 to 11.5.1

* Bump Microsoft packages from 10.0.0-preview.7.25380.108 to 10.0.0-rc.1.25451.107

* Remove Azure.Identity package reference as implicitly referenced versions are no longer vulnerable

* Remove System.Runtime.Caching package reference as it is not used

* Remove System.Net.Http package reference as it is not used

* Set 'allowPrerelease' to true

Global.json was showing as invalid due to a pre-release version being referenced while 'allowPrerelease' was set to 'false'. This can be set to 'false' again later on.

* Remove System.Security.Cryptography.Xml package reference as implicitly referenced versions are no longer vulnerable

* Remove System.Text.RegularExpressions package reference as implicitly referenced versions are no longer vulnerable

* Remove Microsoft.IdentityModel.JsonWebTokens package reference as implicitly referenced versions are no longer vulnerable

* Remove System.Text.Encodings.Web package reference as it is not used

* Remove Microsoft.Data.SqlClient package reference as implicitly referenced versions are no longer vulnerable

* Remove Lucene.Net.Replicator package reference as implicitly referenced versions are no longer vulnerable

* Remove Microsoft.Extensions.Caching.Memory package reference where not used

* Add EFCore migration for OpenIddict v7 update

* Apply suggestion from @kjac

Cosmetic update: Removed blank line as suggested by Copilot

---------

Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>
2025-10-07 12:13:14 +02:00
Mads RasmussenandGitHub e3d2001477 SectionSidebarContextMenu: Delete element and methods for interaction (#20399)
Delete sction-sidebar-context-menu element + context methods
2025-10-07 11:08:35 +01:00
7c0b5b7dd4 Collections: Stop opening items in modals (#20384)
* remove use of modals in collections

* add parent path to support absolute path generation

* add note

* Update src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-07 10:48:09 +01:00
Nhu DinhandGitHub 7bcef5fde5 Nightly E2E test pipeline: QA Run E2E tests on v17/dev and enable the different setting app tests by default (#20379)
Update yaml file to run the nightly E2E tests against the v17/dev branch and run different app settings tests by default
2025-10-07 15:36:54 +07:00
Kenn JacobsenandGitHub 624b5fa640 Merge branch 'v17/dev' into v17/feature/blocks-segment-variation 2025-10-07 08:50:30 +02:00
Niels Lyngsø 173887d0a1 Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace.context.ts
#	src/Umbraco.Web.UI.Client/src/packages/property-editors/slider/types.ts
2025-10-06 16:38:59 +02:00
Kenn JacobsenandGitHub debe205d0e Merge branch 'v17/dev' into v17/feature/blocks-segment-variation 2025-10-06 09:24:54 +02:00
Jacob OvergaardandGitHub c67478874e Segmentation: The Backoffice should use the enhanced endpoint to fetch segment options for documents based on GUID (#20340)
* feat: adds new repository for document by id segment options

* chore: mocks up the new endpoint

* feat: all 'null' segments should appear on all languages

* feat: uses new endpoint in content detail workspace base

* feat: maps up the name of the segment

* chore: mock segment data

* feat: adds filter on available segments

* feat: do not alter behavior depending on "undefined" and "null"

* chore: updates mock handler

* feat: ensures that the segments are loaded based on an override method (because they only work for documents) and that they use a generic type (to avoid circular imports)

* feat: refines the segment filter

* chore: updates deprecated model

* feat: treats all culture-less segments as applying to everything

* docs: updates console warn for developers
2025-10-06 09:09:17 +02:00
Andy Butland 0daf5ea506 Merge branch 'main' into v17/dev 2025-10-03 17:19:03 +02:00
Andreas ZerbstandGitHub 29bdd3cac0 E2E Pipeline: QA Remove continue on error condition (#20371)
Remove
2025-10-03 14:50:23 +02:00
c5b4571cd5 Shared status: improve for segmented scenario (#20354)
* improve shared status messages

* Update src/Umbraco.Web.UI.Client/src/packages/core/property/components/property/property.context.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-03 09:59:07 +02:00
Niels LyngsøandGitHub d45a8f2049 Segments: The experience of working with Segments and Segmented Blocks (#20358)
* initial notes

* flat mapper impl

* first tests passed

* return incoming value to ensure it does not result in an error from an extension

* define the manifest type on UmbPropertyValueResolver

* finish property value flat-mapper

* make sure also to map values with no extension

* clean up test

* export controller

* fix block editor property resolver

* fix mapper types

* ensureVariantsData method

* ensure Block List only updates if it has an update

* ensure varians across for shared across segment and shared across cultures

* fix variant selector hints for segments

* fix hints in variant selector for segmented variants
2025-10-03 09:58:09 +02:00
Niels Lyngsø 2a64bad893 Merge branch 'v17/dev' into v17/feature/blocks-segment-variation 2025-10-02 15:20:36 +02:00
mole 0ded9a74fb Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Core/Services/DocumentUrlService.cs
2025-10-02 15:08:48 +02:00
Kenn JacobsenandGitHub 9774293f71 Merge branch 'v17/dev' into v17/feature/blocks-segment-variation 2025-10-02 10:21:16 +02:00
99c51a54f1 Tiptap RTE: Upgrade to Tiptap v3 (#20318)
* Upgrade to Tiptap v3

* Uses `@ts-expect-error` to ignore the TS complication errors

These can be removed once Tiptap has resolved the TypeScript definitions.

* Off-topic: corrected `flags` property in the mock data

Added in PR #19915

* Update src/Umbraco.Web.UI.Client/src/packages/tiptap/extensions/link/link.tiptap-extension.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com>
2025-10-02 07:44:00 +00:00
3da8f41292 Deprecations: Client-side removal of v17 deprecated code (#20294)
* Webhooks: Removal of client-side deprecations for v17

* User: Removal of client-side deprecations for v17

* UFM: Removal of client-side deprecations for v17

* Tiptap: Removal of client-side deprecations for v17

* Templating: Removal of client-side deprecations for v17

* RTE: Removal of client-side deprecations for v17

* Relations: Removal of client-side deprecations for v17

* Search: Removal of client-side deprecations for v17

* Property Editors: Removal of client-side deprecations for v17

* URL Picker: Removal of client-side deprecations for v17

* Members: Removal of client-side deprecations for v17

* Media: Removal of client-side deprecations for v17

* Extension Insights: Removal of client-side deprecations for v17

* Documents: Removal of client-side deprecations for v17

* Media: Removal of client-side deprecations for v17

(part 2)

* Data Types: Removal of client-side deprecations for v17

* Core: Removal of client-side deprecations for v17

* Content: Removal of client-side deprecations for v17

* Clipboard: Removal of client-side deprecations for v17

* Blocks: Removal of client-side deprecations for v17

* Mocks: Removal of client-side deprecations for v17

* Libs: Removal of client-side deprecations for v17

* Apps: Removal of client-side deprecations for v17

* DevOps: Removal of client-side deprecations for v17

* Document Publishing Workspace: Removal of client-side deprecations for v17

Refactored to use `UmbDocumentPublishingWorkspaceContext`

* Reverted/modified some of my TODO comments

* Updated TODO comment

* Code cleanup sweep of TODO comments and tweaks

* Updated OpenApi.json, re-gen TS client

Tried to fix up mock data.

* Refactored the document variant name/fields

* Implemented co-pilot suggestions

---------

Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com>
2025-10-02 09:14:55 +02:00
Jacob Overgaard f14c4d5968 Merge remote-tracking branch 'origin/main' into v17/dev 2025-10-02 07:42:32 +02:00
Jacob Overgaard 5d986e44f6 Merge remote-tracking branch 'origin/main' into v17/dev 2025-10-01 16:03:06 +02:00
51575e5e36 Property Editors: New Date Time property editors (#19915)
* Started the implementation of the new date time property editor

* Display picked time in local and UTC

* Adjustments to the way the timezones are displayed and the picker is configured

* Filter out `Etc/` (offset) timezones from the list

* Additional adjustments

* Introduced date format and time zone options (all, local or custom)

* Adjustments to the property editor configuration and value converter

* Use UUICombobox instead of UUISelect for displaying time zone options. Display UTC offset instead of short offset name in label.

* Allow searching by offset

* Ignore case when searching for time zone

* Store dates consistently (always same format)

* Add custom PropertyIndexValueFactory for the new property editor

* Adjustments when switching between time zone modes

* Small fixes and cleanup

* Started improving time zone config selection

* Small adjustments

* Remove selected time zones from the list + display label instead of value

* Localizing labels

* Remove unwanted character

* Fix incorrect order of custom time zones list

* Small fixes (mostly validation)

* Rename input time zone component

* Small adjustments

* Using model for stored value

* Save examine value as ISO format

* Adjusting class names for consistency

* Small fixes

* Add default data type configuration

* Rename `TimeZone` to `UmbTimeZone`

* Fix failing tests

* Started adding unit tests for DateWithTimeZonePropertyEditor

* Additional tests

* Additional tests

* Additional tests

* Fixed searches with regex special characters throwing errors

* Remove offset from generic UmbTimeZone type and added new type specific for the property editor

* Adjust property editor to show error when selected time zone is no longer available, instead of pre-selecting another one

* Do not preselect a time zone if a date is stored without time zone

This most likely means that the configuration of the editor changed to add time zone support. In this case we want to force the editor to select the applicable time zone.

* Fix failing backoffice build

* Added tests for DateTimeWithTimeZonePropertyIndexValueFactory

* Improved picker validation

* Remove unused code

* Move models to their corresponding places

* Renaming `DateTimeWithTimeZone` to `DateTime2`

* Fix data type count tests

* Simplifying code + adjusting value converter to support old picker value

* Adjustments to property editor unit tests

* Fix validation issue

* Fix default configuration for 'Date Time (Unspecified)'

* Rename validator

* Fix comment

* Adjust database creator default DateTime2 data types

* Update tests after adjusting default data types

* Add integration test for DateTime2 returned value type

* Apply suggestions from code review

Co-authored-by: Andy Butland <abutland73@gmail.com>

* Aligning DateTime2Validator with other JSON validators. Added new model for API.

* Removed unused code and updated tests

* Fix validation error message

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Splitting the new date time editor into multiple (per output type)

* Adjust tests in DateTime2PropertyIndexValueFactoryTest

* Update value converter tests

* Group the new date time tests

* Adjust new property editor tests

* Adjust property editor integration tests

* Update data editor count tests

* Naming adjustments

* Small fixes

* Cleanup

- Remove unused files
- Remove 'None' option from configuration and update all the tests

* Update luxon depedencies

* Move GetValueFromSource to the value converter

* Add new property editor examples to mock data

* Re-organizing the code

* Adjustments from code review

* Place the date time property index value factories in their own files

* Small adjustments for code consistency

* Small adjustments

* Minor adjustment

* Small fix from copilot review

* Completed the set of XML header comments.

* use already existing query property

* fail is form control element is null or undefined

* using lit ref for querying and form control registration

* state for timeZonePickerValue and remove _disableAddButton

* Adjustments to form control registration

* Remove unused declaration

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Niels Lyngsø <nsl@umbraco.dk>
Co-authored-by: Niels Lyngsø <niels.lyngso@gmail.com>
2025-09-30 13:21:09 +00:00
Kenn JacobsenandGitHub 07203b7270 Segments: Property level default segment fallback (#20309)
Property level default segment fallback
2025-09-30 08:45:20 +02:00
Andy Butland cdb2be64d4 Merge branch 'main' into v17/dev
# Conflicts:
#	tests/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/PropertyTypeBuilderTests.cs
2025-09-30 07:54:26 +02:00
Kenn JacobsenandGitHub c607af1f85 Merge branch 'v17/dev' into v17/feature/blocks-segment-variation 2025-09-29 19:18:17 +02:00
ac6b205e7f Unattended install: Added the ability to set the telemetry level (#20249)
* Added the ability to set the telemetry level for an unattended install

Added 'UnattendedTelemetryLevel' to 'UnattendedSettings'

Renamed 'CreateUnattendedUserNotificationHandler' to 'PostUnattendedInstallNotificationHandler'

Set the telemetry level in the unattended install notification handler

* Add DefaultValue attribute to 'UnattendedTelemetryLevel'

* Added UnattendedTelemetryLevel to template.

* Updated cli and ide hosts.

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
2025-09-29 17:07:30 +02:00
leekelleher 81f29be53b Corrected Tiptap import namespaces
for newer heading extensions, introduced in v16.3.0.
2025-09-25 14:19:22 +01:00
Lee KelleherandGitHub ac23ff5f38 Tiptap: Relocation of external extensions/package (#20256)
* Relocated "Bubble Menu" extension

* Relocated "Table" extension

* Relocated "Anchor" extension

* Relocated "HTML Tag: Div" extension

* Relocated "HTML Tag: Span" extension

* Refactored "HTML Attribute" extensions

* Relocated "Figure" extension

* Relocated "Text Direction" extension

* Relocated "Text Indent" extension

* Relocated "Trailing Node" extension

* Relocated "Embedded Media" extension

* Relocated "Link" extension

* Relocated "Image" extension

* Removed "@umbraco-backoffice/external-tiptap" package

relocated Tiptap exports to the "@umbraco-cms/backoffice/tiptap" package.

* `import` fixes

* Naming of Tiptap extension option interfaces
2025-09-25 14:09:00 +02:00
099e7d7d3a Adding SourceWidth and SourceHeight to ImageUrlGenerationOptions (#14499)
* Update Readme to signpost the Forum (#20268)

Update README.md with information about the forum

Making a small change to the Readme to signpost the Forum now that it's the place to go for help/questions

* Adding SourceWidth and SourceHeight to ImageUrlGenerationOptions

* Update src/Umbraco.Web.Common/Extensions/FriendlyImageCropperTemplateExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* QA Skip the known failing smoke test to avoid blocking other PRs (#20269)

Added skip for the failing smoke test

---------

Co-authored-by: Owain Williams <owaingdwilliams@gmail.com>
Co-authored-by: Jason Elkin <jasonelkin86@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Nhu Dinh <150406148+nhudinh0309@users.noreply.github.com>
2025-09-25 13:38:49 +02:00
Bjarne FyrstenborgandGitHub b1956dea3e Localization/UX: Add a new general translation for "Fields" (#20259)
* Add a new general translation for "Fields"

* 100% height of scroll container
2025-09-25 05:19:36 +00:00
Andy Butland 8d5117fec1 Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Core/Services/PropertyValidationService.cs
#	src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserRepository.cs
#	src/Umbraco.Infrastructure/PublishedContentQuery.cs
#	src/Umbraco.Web.UI.Client/package-lock.json
#	src/Umbraco.Web.UI.Client/package.json
#	src/Umbraco.Web.UI.Client/src/packages/core/tree/default/default-tree.context.ts
#	src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item/tree-item-base/tree-item-element-base.ts
#	templates/UmbracoProject/.template.config/template.json
#	version.json
2025-09-24 23:31:14 +02:00
Andy Butland d8e8e32f75 Merge branch 'main' of https://github.com/umbraco/Umbraco-CMS 2025-09-24 22:30:10 +02:00
Andy Butland 765e5b0ba9 Merge branch 'main' of https://github.com/umbraco/Umbraco-CMS 2025-09-24 20:41:02 +02:00
Kenn JacobsenandGitHub 9fbc325bca Merge branch 'v17/dev' into v17/feature/blocks-segment-variation 2025-09-24 09:25:24 +02:00
Andy Butland 099fd2aa7c Merge branch 'main' of https://github.com/umbraco/Umbraco-CMS 2025-09-24 08:09:06 +02:00
Andy Butland cea2184d47 Merge branch 'v16/bugfix/sorting-by-updateDate-isnt-working-correctly' of https://github.com/umbraco/Umbraco-CMS 2025-09-24 07:09:00 +02:00
Laura NetoandGitHub f5cfbb110e Merge branch 'main' into v16/bugfix/sorting-by-updateDate-isnt-working-correctly 2025-09-23 17:51:29 +02:00
Laura Neto aa2a85328e Display the latest update date in document collection view 2025-09-23 17:12:57 +02:00
Nicklas KramerandGitHub 7db7346d4a Test Data: Fixing endpoint not working #20044 (#20227)
* It worked before i must have broken it somehow. Commit as checkpoint

* Adding a reference from Web.UI.csproj to TestData to allow composers to be composed

* Changing readme and removing project reference
2025-09-23 11:22:29 +00:00
859505e751 Models builder: Move InMemoryAuto models builder and razor runtime compilation into its own package to enable hot reload (#20187)
* Move in memory models builder out of core

* Move runtime validations into backoffice development project

* Obsolete ModelsMode enum

* Move the InMemoryModelsbuilder/RRC novel into the Backoffice development umbraco builder extension

* Add runtime validator to warn if InMemoryAuto is selected but the package isn't installed

* Add backoffice development to template

* Remove propertyGroup

* Remove oopsie

* Check for modelsbuilder in notification handler instead of runtime validator

* Update src/Umbraco.Cms.Api.Management/Controllers/ModelsBuilder/BuildModelsBuilderController.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Umbraco.Infrastructure/Runtime/RuntimeModeValidators/ModelsBuilderModeValidator.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Remove ModelsMode enum and ModelsModeExtensions

* Apply suggestions from code review

Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>

* Move project to source folder

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>
2025-09-23 11:58:09 +02:00
5d17920a73 UTC data migration doesn't work in Linux (closes #20002) (#20112)
* Adjusted the UTC SQL Server migration to convert time zone ids to the correct format

* Apply suggestions from code review

Co-authored-by: Andy Butland <abutland73@gmail.com>

* Small rename

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
2025-09-22 13:16:13 +02:00
815f28e3b9 Section Sidebar Menu: Auto expand to paginated tree items (closes #17074) (#19883)
* align naming

* mute updates

* lower threshold

* add expansion model with target

* add function to link entries

* fix self import

* export constants

* update js docs for entity expansion manager

* link entries

* fix import

* do not export from menu here

* fix import

* fix import

* align how we register manifests

* add specific managers for section sidebar menu

* use structure items

* dot not expand current item

* Refactor section sidebar menu to use programmatic extension slot

Replaces the template-based <umb-extension-slot> with a programmatically created UmbExtensionSlotElement for improved performance and UX.

* add section context extension

* register menu as section context instead of hardcoding

* rename folder

* align naming

* export extension slot elements

* fix typings

* destroy extension slot element when host is disconnected

* Added user start node restrictions to sibling endpoints.

* use entry model

* move and rename

* register global context to hold menu state across sections

* temp observe section specific expansions

* temp observe section specific expansions

* add method to collapse multiple items

* Further integration tests.

* Tidy up.

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* bind expansion to section

* make entity expansion manager generic

* Revert previous update.

* add helper method

* remove temp test data

* Retrieves item counts before and after the target for sibling endpoints and returns in API response.

* Applied previous update correctly.

* Removed blank line.

* Fix build and test asserts following merge.

* add getItem method

* Update OpenApi.json.

* generate new server types

* include last item in target

* add target pagination type

* return totalBefore and totalAfter

* call siblings endpoint for documents

* add method to load children with target

* rename to item

* wip target pagination manager

* add button to load prev tree items

* render prev and nexts buttons for tree items

* Update tree-load-prev-button.element.ts

* add util to append to unique array

* add state method to prepend data

* implement methods to load next and prev items

* add methods to interface

* Update tree-item-element-base.ts

* Update tree-item-context-base.ts

* remove unused

* align methods

* update types

* add jsdocs

* add deprecation notice

* fix jsdocs

* fix import

* Update tree-data-source.interface.ts

* remove duplicate type

* clean up

* fix page calculations

* remove unused

* clean up

* pass full entry to event

* add type for menu item expansion

* export types

* add menuItem alias

* Update types.ts

* support menu item expansion entry

* add const for menu item alias + use for breadcrumb and menu item

* add data type menu item alias const + apply to breadcrumb

* move to correct manifest

* add menu item alias to expand entries

* Update manifests.ts

* add menu structure kind types

* add kind to manifests

* add menu item context

* filter menu items

* handle menu item expansion

* clean up

* fix order

* add example dashboard and entity action

* import types

* align model type names

* align naming

* use ui component

* add guard for menu item entry

* use correct type

* Update section-sidebar-menu.element.ts

* Update entity-expansion.manager.ts

* export constants

* add menuItemAlias to manifest

* add menuItemAlias to manifest

* add menuItemAlias to manifest

* add menuItemAlias to manifest

* add menu item alias

* add menuItemAlias to manifest

* add menuItemAlias to manifest

* add menuItemAlias to manifest

* add alias

* add kind

* fix import path

* do not expand menu from modal

* collect all menu-item files in one folder

* fix lint errors

* Update content-detail-workspace-base.ts

* clean up

* rename to example

* add button to collapse everything within a section

* return correct data from base

* recalculate after

* fix breadcrumb for non-variant structure

* reload entity

* destroy

* remove self

* Updated acceptance tests to check if a caret button is open before clicking

* Bumped version of test helpers

* use const

* add target paging for tree root items

* more specific field names

* update field name

* add model for offset pagination

* add request to model name

* correct

* using Event Contsants for event map

* comment

* clean event listeners before adding new ones

* use createObservablePart

* add paging type guards

* add types

* add check for unique

* add comment

* pass data type id

* wip reload tree logic

* move start + end target logic to target pagination manager

* use target pagination manager in tree item context

* remove local references to start, end and base targets

* calculate before and after when reloading

* clean up

* support children in tree item context

* add methods to observe an expansion entry

* reload structure when item is created

* UX adjustments

* add controller alias to observer

* Update default-tree.context.ts

* Update default-tree.context.ts

* Update default-tree.context.ts

* test targets in document type tree data source

* when reloading only send the target if its part of the current items

* wip tree request manager

* make data source base a controller

* add tree request helper for document types

* use request helper in data source

* clear more data when clear is called

* when reopening a tree item - reuse previous state

* add tree item children manager

* split to manager

* clean up

* only return an entity model when getting target

* allow entity model as target

* add null checks

* add method for getSiblingsFrom

* implement target for tree data request manager

* Update default-tree.context.ts

* set parent for tree root

* reload if target is new

* add types for tree data request manager

* implement request manager for document tree

* use request manager for media tree

* add request manager for data type tree

* move into folder

* move into folder

* move into folder

* add target support for document blueprint

* add request manager for template tree

* add request manager for media type tree

* add hasChildren flag for root

* make start node its own thing

* move hasChildren logic to children manager

* Create tree-item-expansion.manager.ts

* use expansion manager

* align tree item managers

* Update tree-item-context-base.ts

* support take 0

* add methods to get new targets

* add retries

* add button loading states

* fix next start and end

* reset baset target

* use clear when restting children

* throw error if parent doesn't match request

* show notifcation when children is reset

* only render menu context for non trashed document and media items

* use correct import

* fix types

* update interfaces and imports to fix circular dependencies

* move into tree-item folder

* rename file

* Update tree-item-context-base.ts

* move token out of context file to remove circular dependency

* set take size to 50

* remove unused

* export const

* correct default value

* check on both sides after a new base target

* `import type` sort ordering

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Andreas Zerbst <andr317c@live.dk>
Co-authored-by: Niels Lyngsø <nsl@umbraco.dk>
Co-authored-by: Niels Lyngsø <niels.lyngso@gmail.com>
Co-authored-by: leekelleher <leekelleher@gmail.com>
2025-09-22 07:22:54 +00:00
Kenn JacobsenandGitHub 464661db63 Merge branch 'v17/dev' into v17/feature/blocks-segment-variation 2025-09-22 08:02:49 +02:00
a7bb1fc20d Repositories: Quote table and columns and use NPoco extensions over raw SQL (#20034)
* fix sql syntax issues

* unify all dtos, fix autoIncrement for NPoco.Insert and .BulkInsert

* fix Copilot review comments

* fix sql syntax in TrackedReferencesRepository.GetPagedDescendantsInReferences()

* remove changes in TemplateServiceTests

* Tweaks and fixes from first review.

* Reverted changes outside scope of PR.

* Use FirstOrDefault over SelectTop.

* Fix delete member issue.

* Fixed issue with create of webhooks.

* Reverted changes to default data install.

* Removed unused method.

* Rationalised use of quoting helpers.

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix nullability issue.

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-20 11:40:16 +02:00
dca70a0bd0 Dependencies: Updates to .NET 10 RC and NPoco 6.1 (#20184)
* Update to .NET 10 RC 1.

* Update NPoco to 6.1.0 and resolve binary breaking changes.

* Resolved behavioural breaking changes (need to use List<string> over string[] for Contains).

* Update dependency on NPoco.SqlServer.

* Further fixes from manual testing.

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fixed comment typos.

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fixed nullability issue.

* Fix database creation issue

* Fix missing to list

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: nikolajlauridsen <nikolajlauridsen@protonmail.ch>
2025-09-19 08:59:03 +00:00
Andy Butland 07641981a4 Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Cms.Api.Management/Controllers/Content/ContentCollectionControllerBase.cs
#	src/Umbraco.Core/Services/IMemberService.cs
#	src/Umbraco.Core/Services/MemberService.cs
2025-09-17 15:42:23 +02:00
Andy Butland b593d9dadf Merge branch 'v17/dev' of https://github.com/umbraco/Umbraco-CMS into v17/dev 2025-09-17 12:48:12 +02:00
dd01a56d2a Feature: single block property editor (#20098)
* First Go at the single block property editor based on blocklistpropertyeditor

* Add simalar tests to the blocklist editor

Also check whether either block of configured blocks can be picked and used from a data perspective

* WIP singleblock Valiation tests

* Finished first full pass off SingleBlock validation testing

* Typos, Future test function

* Restore accidently removed file

* Introduce propertyValueConverter

* Comment updates

* Add singleBlock renderer

* Textual improvements

Comment improvements, remove licensing in file

* Update DataEditorCount by 1 as we introduced a new one

* Align test naming

* Add ignored singleblock default renderer

* Enable SingleBlock Property Indexing

* Enable Partial value merging

* Fix indentation

---------

Co-authored-by: kjac <kja@umbraco.dk>
2025-09-17 07:20:09 +02:00
Andy Butland 8a342be4f4 Merge branch 'v17/dev' of https://github.com/umbraco/Umbraco-CMS into v17/dev 2025-09-16 14:11:49 +02:00
Laura Neto eea970a648 Fix merge issues in DataTypeService 2025-09-16 13:01:48 +02:00
Andy Butland 20a2f90441 Merge branch 'main' into v17/dev 2025-09-16 10:33:09 +02:00
Jacob OvergaardandGitHub 3d7ac5776c V17: Moves current-user related entities from 'user' to 'current-user' package (#20125)
* fix: moves current user config repository and related dependencies to the 'current-user' package

previously, it was not exported, so is not a breaking change

* chore: moves current-user-allow-mfa condition to the 'current-user' package to avoid circular dependencies (and because it naturally belongs there)

* feat: exports all current-user config-related items

* chore: move to 'current-user'

* chore: make sure to export all constants
2025-09-15 15:14:48 +01:00
Andy Butland c3eabda10e Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Core/Services/DataTypeService.cs
2025-09-15 13:36:37 +02:00
d3e6508952 Repositories: Introduce and use NPoco and custom extension methods for SQL syntax in ContentTypeRepositoryBase (#19986)
* fix Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
     .ContentTypeRepositoryBase.DeletePropertyType method.

* fix more sql syntax

* fix review comments

* Fixed issues raised in code review.

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
2025-09-15 10:25:11 +00:00
Laura Neto 6dc9191ad3 Fix wrong migration order 2025-09-09 11:04:10 +02:00
Laura Neto f4c0264e61 Merge branch 'main' into v17/dev 2025-09-09 10:17:47 +02:00
Mads Rasmussen 60a03c75e4 Merge branch 'main' into v17/dev 2025-09-05 10:03:04 +02:00
MoleandGitHub f050488b92 V17: Update to dotnet 10 (#20007)
* Update dotnet version

* Update packages

* Fix System.Linq.Async breaking change

* Fix #19867

* Update template.json

* Set LTS version to 17

* Update dockerfile
2025-09-04 08:08:35 +02:00
kjac 170f25118c Merge branch 'v17/dev' into v17/feature/blocks-segment-variation 2025-09-02 12:24:14 +02:00
kjac 5a0a2bf77e Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.PublishedCache.HybridCache/Factories/PublishedContentFactory.cs
2025-09-02 10:22:39 +02:00
Nicklas KramerandGitHub da8c036719 V17 - Removing obsoleted code from Umbraco.Core (#20009)
* Removing obsoleted code from ApiMediaQueryService.cs

* Removing obsoleted code from ApiRichTextMarkupParserTests.cs

* Removing obsoleted code from ContentCacheRefresher.cs

* Removing obsoleted code from ContentFinderByUrlAlias.cs and adjusting its tests to use the new logic

* Removing obsoleted code from ContentFinderByUrl.cs & its dependencies

* Removing obsoleted code from ApiRichTextMarkupParserTests.cs

* Removing obsoleted code from DocumentCache.cs & its dependencies

* Removing obsoleted code from MediaCache.cs & its dependencies

* Removing obsoleted code from PublishedCacheBase.cs & its dependencies

* Removing obsoleted code from RenderNoContentController.cs and its tests

* Removing obsoleted code from UmbracoRouteValueTransformer.cs

* Removing obsoleted constructors from DefaultUrlProvider.cs

* Removing accidental bookmark

* Introducing a helper method to get the root keys in ApiMediaQueryService.cs

* Removing obsoleted code from Cache classes

* Removing unused imports

* Refactoring to meet the CR

* Added attribute to controller

* Fixing missing using statement

* Removing obsoleted constructor from ExternalLoginService.cs and making usages fit

* Removing obsoleted method from IContentTypeFilter.cs

* Removing obsoleted methods from IContentEditingService.cs

* Removing obosoleted code from DocumentUrlService.cs

* Removed obsoleted code from DataTypeService.cs

* Removed obsoleted code from PublishStatusService.cs

* Removing obsoleted code from the IContentPublishingService.cs and its dependencies. Also implementing a TODO in the service implementation

* Removing obsoleted code from IRelationService.cs

* Removing obsoleted code from ContentPublishingService.cs

* Removing obsoleted code from ContentEditingService.cs

* Removing obsoleted code from Constants-DataTypes.cs

* Removing obsoleted code from IAction.cs and its implementations

* Removing obsoleted code from IContentService.cs

* Removing obsoleted code from DomainUtilities.cs

* Removing obsoleted code from IIndexedEntitySearchService.cs and dependencies

* Removing obsoleted code from UrlProvider.cs

* Removing obsoleted code from AliasUrlProvider.cs

* Removing obsoleted code from ApiContentRouteBuilder.cs

* Removing obsoleted code from ApiPublishedContentCache.cs

* Removing obsoleted class TemplateQueryResult.cs

* Removing obsoleted code from ApiContentBuilder.cs

* Removing obsoleted code from HealthCheck.cs

* Removing obsoleted code from ContentTypeEditingService.cs

* Removing obsoleted code from NewDefaultUrlProvider.cs

* Removing obsoleted code from PublishedElementPropertyBase.cs

* Removing obsoleted code from WebhookRequestService.cs

* Bumping to obsolete in V18, due to usage in class that will be removed in V18

* Removing obsoleted code from PropertyValidationService.cs

* Removing obsoleted code from AddUnroutableContentWarningsWhenPublishingNotificationHandler.cs

* Removing obsoleted code from IMemberService.cs

* Removing obsoleted code from DocumentCache.cs
2025-08-28 12:09:59 +02:00
kjac c50f1845f6 Block level segment variation 2025-08-27 21:34:34 +02:00
Nicklas KramerandGitHub 20c29f8091 V17 - Removed obsoleted code from Umbraco.Cms.Core.Cache & .Routing (#19959)
* Removing obsoleted code from ApiMediaQueryService.cs

* Removing obsoleted code from ApiRichTextMarkupParserTests.cs

* Removing obsoleted code from ContentCacheRefresher.cs

* Removing obsoleted code from ContentFinderByUrlAlias.cs and adjusting its tests to use the new logic

* Removing obsoleted code from ContentFinderByUrl.cs & its dependencies

* Removing obsoleted code from ApiRichTextMarkupParserTests.cs

* Removing obsoleted code from DocumentCache.cs & its dependencies

* Removing obsoleted code from MediaCache.cs & its dependencies

* Removing obsoleted code from PublishedCacheBase.cs & its dependencies

* Removing obsoleted code from RenderNoContentController.cs and its tests

* Removing obsoleted code from UmbracoRouteValueTransformer.cs

* Removing obsoleted constructors from DefaultUrlProvider.cs

* Removing accidental bookmark

* Introducing a helper method to get the root keys in ApiMediaQueryService.cs

* Removing obsoleted code from Cache classes

* Removing unused imports

* Refactoring to meet the CR

* Added attribute to controller

* Fixing missing using statement
2025-08-27 11:02:21 +02:00
Nicklas KramerandGitHub b8ca11edd6 V17 - Content Finder unit tests cleanup (#19989)
* Removing ContentFinderByUrlAndTemplateTests.cs and dependencies

* Removing ContentFinderByAliasTests.cs

* Removing ContentFinderByAliasWithDomainsTests.cs

* Removing ContentFinderByIdentifierTestsBase.cs

* Removing ContentFinderByIdTests.cs

* Fixing ContentFinderByKeyTests.cs & ContentFinderByPageIdQueryTests.cs to work with new code

* Removing ContentFinderByUrlTests.cs & ContentFinderByUrlWithDomainsTests.cs

* Fixing ContentFinderByPageIdQueryTests.cs to actually test the result rather than force the result

* Removing comment and adding test scenario
2025-08-27 07:39:03 +00:00
2a6bb64c78 V17 - Properties and validators, removing obsoleted code (#19961)
* Removing obsoleted code from ApiMediaQueryService.cs

* Removing obsoleted code from ApiRichTextMarkupParserTests.cs

* Removing obsoleted code from ContentCacheRefresher.cs

* Removing obsoleted code from ContentFinderByUrlAlias.cs and adjusting its tests to use the new logic

* Removing obsoleted code from ContentFinderByUrl.cs & its dependencies

* Removing obsoleted code from ApiRichTextMarkupParserTests.cs

* Removing obsoleted code from DocumentCache.cs & its dependencies

* Removing obsoleted code from MediaCache.cs & its dependencies

* Removing obsoleted code from PublishedCacheBase.cs & its dependencies

* Removing obsoleted code from RenderNoContentController.cs and its tests

* Removing obsoleted code from UmbracoRouteValueTransformer.cs

* Removing obsoleted constructors from DefaultUrlProvider.cs

* Removing the RadioValueEditor.cs & RadioValueValidator.cs obsoleted classes.

* Removing obsolete constructor from MultipleValueValidator.cs

* Removing obsolete constructor from EmailValidator.cs

* Removing obsoleted code from DataValueReferenceFactoryCollection.cs

* Removing obsoleted code from ApiContentBuilderBase.cs

* Fixing constructor missing attribute

* Making use of the TryGet result

* Fixing use of obsoleted constructor

* Removing silly bookmark comment

* Fixing deleted code and restructuring to use new cache

* Making use of TryGetRootKeys bool, to return null if false.

* Extending code to use new constructor

* Updated PublishedContentQuery.cs to return empty array

Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>

---------

Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
2025-08-26 11:31:27 +00:00
Nicklas KramerandGitHub 156bcdc98a V17 - Removing obsoleted code from Umbraco.Web (#19983)
* Removing obsoleted code from AspNetCoreCookieManager.cs & Dependencies

* Removing obosoleted code from AspNetCoreBackOfficeInfo.cs

* Removing obosoleted code from PublishedContentExtensions.cs

* Removing obosoleted code from UmbracoMvcConfigureOptions.cs

* Removing obosoleted code from UmbracoVirtualPageRoute.cs

* Removing obsoleted constructor from BasicAuthenticationMiddleware.cs

* Removing obsoleted constructors from UmbLoginController.cs

* Removing unused constructor
2025-08-26 10:54:03 +00:00
Nicklas KramerandGitHub 07abec239d V17 - Removed obsoleted code from Cms.Api (#19963)
* Removing obsoleted constructor from SubTypesSelector.cs

* V17 - Removed obsoleted code from Cms.Api.Delivery (#19964)

* Removing obsoleted constructors from AncestorsSelector.cs

* Removing obsoleted constructors from ChildrenSelector.cs

* Removing obsoleted code from DescendantsSelector.cs

* Removing obsoleted code from RequestCultureService.cs

* Removing obsoleted code from QueryOptionBase.cs

* Removing obsoleted code from BackOfficeApplicationManager.cs & Dependencies

* Removing obsoleted code from ByKeyDocumentController.cs

* Removing obsoleted code from ContentCollectionControllerBase.cs & dependencies

* Removing obsoleted code from DocumentPresentationFactory.cs

* Removing obsoleted code from HealthCheckGroupPresentationFactory.cs & dependencies & IBackOfficeApplicationManager.cs

* Removing obsoleted code from DocumentPermissionMapper.cs

* Removing obsoleted code from DocumentResponseModel.cs

* Removing obsoleted code from ExecuteTemplateQueryController.cs

* Removing obsoleted code from MediaCollectionControllerBase.cs & Dependencies

* Removing the class ReferencesDataTypeController.cs

* Removing obsoleted code from RelationTypePresentationFactory.cs

* Removing obsoleted code from SearchDocumentTypeItemController.cs

* Removing obsoleted code from  UserPresentationFactory.cs & Dependencies

* Removing obsoleted code from ValidateCreateDocumentController.cs & Dependencies

* Removing unused imports and redundant attribute

* Removing unused constructor attribute
2025-08-25 07:37:18 +00:00
Nicklas KramerandGitHub 50ae48b0a2 V17 - Removed obsoleted code from Umbraco.Infrastructure (#19977)
* Removing obsoleted code from MigrationPlanExecutor.cs & Interface

* Removing obsoleted code from EmailAddressPropertyEditor.cs

* Removing obsoleted class CacheRebuilder.cs

* Removing obsoleted code from TextBuilder.cs

* Removing obsoleted class ICacheRebuilder.cs

* Removing obsoleted code from SerilogLogger.cs

* Removing the use of Infrastructure IBackgroundTaskQueue.cs and replacing usage with the Core replacement

* Removing obsoleted code from the FileUploadPropertyEditor.cs

* Removing obsoleted code from BlockValuePropertyValueEditorBase.cs

* Removing obsoleted constructors and methods from MultiNodeTreePickerPropertyEditor.cs and TextHeaderWriter.cs

* Removing obsoleted code from CacheInstructionService.cs

* Bumping obsoleted code from MigrationBase.cs to V18

* Removing obsoleted code from EmailSender.cs

* Removing obsoleted code from BlockEditorVarianceHandler.cs

* Removing obsoleted code from IBackOfficeApplicationManager.cs

* Removing obsoleted code from RedirectTracker.cs & RichTextEditorPastedImages.cs
2025-08-22 14:38:27 +02:00
Andy Butland 0b2a247614 Merge branch 'v17/dev' of https://github.com/umbraco/Umbraco-CMS into v17/dev 2025-08-22 13:58:51 +02:00
Andy Butland f2b5061414 Merge branch 'main' into v17/dev 2025-08-22 13:58:39 +02:00
d623476902 Use UTC for system dates in Umbraco (#19822)
* Persist and expose Umbraco system dates as UTC (#19705)

* Updated persistence DTOs defining default dates to use UTC.

* Remove ForceToUtc = false from all persistence DTO attributes (default when not specified is true).

* Removed use of SpecifyKind setting dates to local.

* Removed unnecessary Utc suffixes on properties.

* Persist current date time with UtcNow.

* Removed further necessary Utc suffixes and fixed failing unit tests.

* Added migration for SQL server to update database date default constraints.

* Added comment justifying not providing a migration for SQLite default date constraints.

* Ensure UTC for datetimes created from persistence DTOs.

* Ensure UTC when creating dates for published content rendering in Razor and outputting in delivery API.

* Fixed migration SQL syntax.

* Introduced AuditItemFactory for creating entries for the backoffice document history, so we can control the UTC setting on the retrieved persisted dates.

* Ensured UTC dates are retrieved for document versions.

* Ensured UTC is returned for backoffice display of last edited and published for variant content.

* Fixed SQLite syntax for default current datetime.

* Apply suggestions from code review

Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>

* Further updates from code review.

---------

Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>

* Migrate system dates from local server time to UTC (#19798)

* Add settings for the migration.

* Add migration and implement for SQL server.

* Implement for SQLite.

* Fixes from testing with SQL Server.

* Fixes from testing with SQLite.

* Code tidy.

* Cleaned up usings.

* Removed audit log date from conversion.

* Removed webhook log date from conversion.

* Updated update date initialization on saving dictionary items.

* Updated filter on log queries.

* Use timezone ID instead of system name to work cross-culture.

---------

Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>
2025-08-22 11:59:23 +02:00
Andy Butland b427a8cbdd Merge branch 'main' into v17/dev 2025-08-22 09:58:14 +02:00
Nicklas KramerandGitHub bd8ad5f6f9 V17 - Removed obsoleted code from Umbraco.Examine (#19966)
Removing obsoleted code from BackOfficeExamineSearcher.cs and dependencies
2025-08-22 07:58:17 +02:00
Nicklas KramerandGitHub 596389d961 V17 - Removed obsoleted code from Umbraco.Extension (#19937)
* Removing obsoleted class GlobalSettingsExtensions.cs

* Removing obsoleted methods and usage from ObjectExtensions.cs

* Removing a ton of obsoleted methods from PublishedContentExtensions.cs

* Removing obsoleted constructors

* Removing obsoleted tag on private method that's still in use.
2025-08-22 07:32:18 +02:00
Andy Butland cd00dfaa34 Merge branch 'main' into v17/dev 2025-08-20 11:57:01 +01:00
Andy Butland 6d5271fb80 Merge branch 'main' into v17/dev 2025-08-18 13:46:04 +01:00
Andy Butland f8ec2dadfe Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Web.UI.Client/package-lock.json
#	src/Umbraco.Web.UI.Client/package.json
#	version.json
2025-08-18 07:16:06 +01:00
Laura Neto e57f66537c Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Web.UI.Client/package-lock.json
2025-08-11 11:32:52 +02:00
DevAndersenandGitHub ab0af2a291 Changed methods in ServiceCollectionExtensions to return IServiceCollection instead of void (#19785) 2025-08-07 12:16:36 +02:00
5fc12ec36e Support persistence of unrestricted selections from the check box list (#19856)
* Use unrestricted text field when creating data types based on the CheckboxList property editor.
Initialize default checkbox list data type with the unrestricted text field for storage on new installs.
Migrate existing data type and property data.

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Correctly use constant.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-05 13:19:25 +02:00
Andy Butland 73d2f207d0 Merge branch 'main' into v17/dev 2025-08-04 12:41:50 +02:00
c3e93f143c Fix nullability of return types that can be non-null (#15927)
* Fix nullability of Children extension

* Fix nullability of methods throughout the CMS

* Fix return types of some methods that cannot return null

* Revert nullable changes to result of ConvertSourceToIntermediate for property editors (whilst some property editors we know won't return null, it seems more consistent to adhere to the base class and interface nullability definition).

* Updated new webhook events to align with new nullability definitions.

* Reverted content editing service updates to align with base classes.

* Applied collection nullability updates on content repository to interface.

* Reverted value converter updates to match interface.

* Applied further collection updates to interface.

* Aligned media service interface with implementation for nullability.

* Update from code review.

---------

Co-authored-by: Ivo van der Bruggen <ivo@dutchbreeze.com>
Co-authored-by: Ivo van der Bruggen <ivo@vdbruggensoftware.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
2025-07-30 14:19:20 +02:00
Andy Butland c6bc4ef49a Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Web.UI.Client/package.json
2025-07-30 11:30:10 +02:00
Laura NetoandGitHub c1ac80653b Use audit service instead of repository directly in services (#19357)
* Introduce new AuditEntryService

- Moved logic related to the IAuditEntryRepository from the AuditService to the new service
- Introduced new Async methods
  - Using ids (for easier transition from the previous Write method)
  - Using keys
- Moved and updated integration tests related to the audit entries to a new test class `AuditEntryServiceTests`
- Added unit tests class `AuditEntryServiceTests` and added a few unit tests
- Added migration to add columns for `performingUserKey` and `affectedUserKey` and convert existing user ids
- Adjusted usages of the old AuditService.Write method to use the new one (mostly notification handlers)

* Audit service rework

- Added new async and paged methods
- Marked (now) redundant methods as obsolete
- Updated all of the usages to use the non-obsolete methods
- Added unit tests class `AuditServiceTests` and some unit tests
- Updated existing integration test

* Use the audit service instead of the repository directly in services

* Apply suggestions from code review

* Small improvement

* Update src/Umbraco.Core/Services/AuditService.cs

* Some minor adjustments following the merge

* Delete unnecessary file

* Small cleanup on the tests

* Remove changing user id to 0 (on audit) if user id is admin in media bulk save

* Remove reference to unused IUserIdKeyResolver in TemplateService

* Remove references to unused IShortStringHelper and GlobalSettings in FileService
2025-07-24 14:52:17 +02:00
a50ad893a8 Use new submit and poll solution for examine index rebuild (#19707)
* Started implementing new LongRunningOperationService and adjusting tasks to use this service

This service will manage operations that require status to be synced between servers (load balanced setup).

* Missing migration to add new lock. Other simplifications.

* Add job to cleanup the LongRunningOperations entries

* Add new DatabaseCacheRebuilder.RebuildAsync method

This is both async and returns an attempt, which will fail if a rebuild operation is already running.

* Missing LongRunningOperation database table creation on clean install

* Store expire date in the long running operation. Better handling of non-background operations.

Storing an expiration date allows setting different expiration times depending on the type of operation, and whether it is running in the background or not.

* Added integration tests for LongRunningOperationRepository

* Added unit tests for LongRunningOperationService

* Add type as a parameter to more repository calls. Distinguish between expiration and deletion in `LongRunningOperationRepository.CleanOperations`.

* Fix failing unit test

* Fixed `PerformPublishBranchAsync` result not being deserialized correctly

* Remove unnecessary DatabaseCacheRebuildResult value

* Add status to `LongRunningOperationService.GetResult` attempt to inform on why a result could not be retrieved

* General improvements

* Missing rename

* Improve the handling of long running operations that are not in background and stale operations

* Fix failing unit tests

* Fixed small mismatch between interface and implementation

* Use the new submit and poll functionality for the Examine index rebuild

* Use a fire and forget task instead of the background queue

* Apply suggestions from code review

Co-authored-by: Andy Butland <abutland73@gmail.com>

* Make sure exceptions are caught when running in the background

* Alignment with other repositories (async + pagination)

* Fix build after merge

* Missing obsoletion messages

* Additional fixes

* Add Async suffix to service methods

* Missing adjustment

* Moved hardcoded settings to IOptions

* Fix issue in SQL Server where 0 is not accepted as requested number of rows

* Fix issue in SQL Server where query provided to count cannot contain orderby

* Additional SQL Server fixes

* Update method names

* Adjustments from code review

* Ignoring result of index rebuild in `IndexingNotificationHandler.Language.cs` (same behavior as before)

* Missed some obsoletion messages

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
2025-07-24 14:30:14 +02:00
Andy Butland a6c311977c Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs
2025-07-23 17:03:30 +02:00
Laura Neto 04ac8d3ea9 Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs
2025-07-22 15:39:26 +02:00
Laura NetoandGitHub 3fcc09169a Update the existing date/time property editor to provide a kind of unspecified (#19727)
* Update the existing date/time property editor to provide a Kind of Unspecified

* Added unit tests
2025-07-22 11:55:52 +02:00
Laura Neto 2ce647738f Merge branch 'main' into v17/dev
# Conflicts:
#	version.json
2025-07-14 15:41:34 +02:00
Andy Butland 4a438ad6e9 Disabled package validation. 2025-07-08 14:37:45 +02:00
Andy Butland 0b1bd16b9d Merge branch 'main' into v17/dev 2025-07-08 09:26:54 +02:00
Laura NetoandGitHub 447cb881bd Audit service rework (#19346)
* Introduce new AuditEntryService

- Moved logic related to the IAuditEntryRepository from the AuditService to the new service
- Introduced new Async methods
  - Using ids (for easier transition from the previous Write method)
  - Using keys
- Moved and updated integration tests related to the audit entries to a new test class `AuditEntryServiceTests`
- Added unit tests class `AuditEntryServiceTests` and added a few unit tests
- Added migration to add columns for `performingUserKey` and `affectedUserKey` and convert existing user ids
- Adjusted usages of the old AuditService.Write method to use the new one (mostly notification handlers)

* Audit service rework

- Added new async and paged methods
- Marked (now) redundant methods as obsolete
- Updated all of the usages to use the non-obsolete methods
- Added unit tests class `AuditServiceTests` and some unit tests
- Updated existing integration test

* Apply suggestions from code review

* Small improvement

* Update src/Umbraco.Core/Services/AuditService.cs

* Some minor adjustments following the merge

* Delete unnecessary file

* Small cleanup on the tests
2025-07-01 09:12:37 +02:00
Andy Butland ceb745a7bd Merge branch 'main' into v17/dev
# Conflicts:
#	src/Umbraco.Core/Services/AuditService.cs
#	src/Umbraco.Core/Services/IAuditService.cs
2025-06-09 06:49:12 +02:00
Laura NetoandGitHub 7fc2bc84de Audit entries rework (#19345)
* Introduce new AuditEntryService

- Moved logic related to the IAuditEntryRepository from the AuditService to the new service
- Introduced new Async methods
  - Using ids (for easier transition from the previous Write method)
  - Using keys
- Moved and updated integration tests related to the audit entries to a new test class `AuditEntryServiceTests`
- Added unit tests class `AuditEntryServiceTests` and added a few unit tests
- Added migration to add columns for `performingUserKey` and `affectedUserKey` and convert existing user ids
- Adjusted usages of the old AuditService.Write method to use the new one (mostly notification handlers)

* Apply suggestions from code review

* Small improvement

* Some adjustments following code review. Removed UnknownUserKey and used null instead.

* Small adjustments

* Better handle audits performed during the migration state

* Update TODO comment
2025-06-06 13:12:35 +02:00
Dirk SeefeldandMatthew-Wise 321087c96e update data type descriptions for color picker according to PR 19430 2025-05-30 15:38:45 +01:00
Dirk SeefeldandMatthew-Wise f0e37e04fa fix issue 19341 2025-05-30 11:18:45 +01:00
Jacob Overgaard 135f0f63de Merge branch 'main' into v17/dev 2025-05-16 16:58:11 +02:00
2dced37117 Clean up extension methods (#17051)
Co-authored-by: Andy Butland <abutland73@gmail.com>
2025-05-05 14:53:26 +02:00
Jacob Overgaard 44d9f5ac2e build: bump version to 17.0.0-rc 2025-05-05 14:52:52 +02:00
2211 changed files with 50921 additions and 24778 deletions
+3
View File
@@ -1,5 +1,8 @@
{
"cSpell.words": [
"backoffice",
"pickable",
"Pickable",
"unprovide",
"Unproviding"
],
+2 -2
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Company>Umbraco HQ</Company>
<Authors>Umbraco</Authors>
<Copyright>Copyright © Umbraco $([System.DateTime]::Today.ToString('yyyy'))</Copyright>
@@ -40,7 +40,7 @@
<!-- Package Validation -->
<PropertyGroup>
<GenerateCompatibilitySuppressionFile>false</GenerateCompatibilitySuppressionFile>
<EnablePackageValidation>true</EnablePackageValidation>
<EnablePackageValidation>false</EnablePackageValidation> <!-- TODO (V17): Set to true with version 17.0.0 once this version is released. -->
<PackageValidationBaselineVersion>16.0.0</PackageValidationBaselineVersion>
<EnableStrictModeForCompatibleFrameworksInPackage>true</EnableStrictModeForCompatibleFrameworksInPackage>
<EnableStrictModeForCompatibleTfms>true</EnableStrictModeForCompatibleTfms>
+37 -58
View File
@@ -5,36 +5,35 @@
</PropertyGroup>
<!-- Global packages (private, build-time packages for all projects) -->
<ItemGroup>
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.7.115" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.8.118" />
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<GlobalPackageReference Include="Umbraco.Code" Version="2.3.0" />
<GlobalPackageReference Include="Umbraco.Code" Version="2.4.0" />
<GlobalPackageReference Include="Umbraco.GitVersioning.Extensions" Version="0.2.0" />
</ItemGroup>
<!-- Microsoft packages -->
<ItemGroup>
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="9.0.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.13.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.13.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.13.0" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="9.0.4" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.4" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Physical" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Identity.Core" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Identity.Stores" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Caching.Hybrid" Version="9.4.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Embedded" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Physical" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Identity.Core" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Identity.Stores" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Caching.Hybrid" Version="9.9.0" />
<PackageVersion Include="System.Linq.Async" Version="6.0.3" />
</ItemGroup>
<!-- Umbraco packages -->
<ItemGroup>
@@ -47,21 +46,21 @@
<PackageVersion Include="Dazinator.Extensions.FileProviders" Version="2.0.0" />
<PackageVersion Include="Examine" Version="3.7.1" />
<PackageVersion Include="Examine.Core" Version="3.7.1" />
<PackageVersion Include="HtmlAgilityPack" Version="1.12.1" />
<PackageVersion Include="HtmlAgilityPack" Version="1.12.4" />
<PackageVersion Include="JsonPatch.Net" Version="3.3.0" />
<PackageVersion Include="K4os.Compression.LZ4" Version="1.3.8" />
<PackageVersion Include="MailKit" Version="4.11.0" />
<PackageVersion Include="MailKit" Version="4.14.0" />
<PackageVersion Include="Markdown" Version="2.2.1" />
<PackageVersion Include="MessagePack" Version="3.1.3" />
<PackageVersion Include="MessagePack" Version="3.1.4" />
<PackageVersion Include="MiniProfiler.AspNetCore.Mvc" Version="4.5.4" />
<PackageVersion Include="MiniProfiler.Shared" Version="4.5.4" />
<PackageVersion Include="ncrontab" Version="3.3.3" />
<PackageVersion Include="NPoco" Version="5.7.1" />
<PackageVersion Include="NPoco.SqlServer" Version="5.7.1" />
<PackageVersion Include="OpenIddict.Abstractions" Version="6.2.1" />
<PackageVersion Include="OpenIddict.AspNetCore" Version="6.2.1" />
<PackageVersion Include="OpenIddict.EntityFrameworkCore" Version="6.2.1" />
<PackageVersion Include="Serilog" Version="4.2.0" />
<PackageVersion Include="ncrontab" Version="3.4.0" />
<PackageVersion Include="NPoco" Version="6.1.0" />
<PackageVersion Include="NPoco.SqlServer" Version="6.1.0" />
<PackageVersion Include="OpenIddict.Abstractions" Version="7.1.0" />
<PackageVersion Include="OpenIddict.AspNetCore" Version="7.1.0" />
<PackageVersion Include="OpenIddict.EntityFrameworkCore" Version="7.1.0" />
<PackageVersion Include="Serilog" Version="4.3.0" />
<PackageVersion Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageVersion Include="Serilog.Enrichers.Process" Version="3.0.0" />
<PackageVersion Include="Serilog.Enrichers.Thread" Version="4.0.0" />
@@ -71,33 +70,13 @@
<PackageVersion Include="Serilog.Formatting.Compact.Reader" Version="4.0.0" />
<PackageVersion Include="Serilog.Settings.Configuration" Version="9.0.0" />
<PackageVersion Include="Serilog.Sinks.Async" Version="2.1.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="7.0.0" />
<PackageVersion Include="Serilog.Sinks.Map" Version="2.0.0" />
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.11" />
<PackageVersion Include="SixLabors.ImageSharp.Web" Version="3.1.5" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="8.1.1" />
<PackageVersion Include="SixLabors.ImageSharp.Web" Version="3.2.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="9.0.6" />
</ItemGroup>
<!-- Transitive pinned versions (only required because our direct dependencies have vulnerable versions of transitive dependencies) -->
<ItemGroup>
<!-- Microsoft.EntityFrameworkCore.SqlServer and NPoco.SqlServer brings in a vulnerable version of Azure.Identity -->
<!-- Take top-level depedendency on Azure.Identity, because Microsoft.EntityFrameworkCore.SqlServer depends on a vulnerable version -->
<PackageVersion Include="Azure.Identity" Version="1.13.2" />
<!-- Microsoft.EntityFrameworkCore.SqlServer brings in a vulnerable version of System.Runtime.Caching -->
<PackageVersion Include="System.Runtime.Caching" Version="9.0.4" />
<!-- Dazinator.Extensions.FileProviders brings in a vulnerable version of System.Net.Http -->
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<!-- Examine brings in a vulnerable version of System.Security.Cryptography.Xml -->
<PackageVersion Include="System.Security.Cryptography.Xml" Version="9.0.4" />
<!-- Dazinator.Extensions.FileProviders and MiniProfiler.AspNetCore.Mvc brings in a vulnerable version of System.Text.RegularExpressions -->
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<!-- OpenIddict.AspNetCore, Npoco.SqlServer and Microsoft.EntityFrameworkCore.SqlServer brings in a vulnerable version of Microsoft.IdentityModel.JsonWebTokens -->
<!-- Take top-level depedendency on Microsoft.IdentityModel.JsonWebTokens, because OpenIddict.AspNetCore, Npoco.SqlServer and Microsoft.EntityFrameworkCore.SqlServer depends on a vulnerable version -->
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.8.0" />
<!-- Azure.Identity, Microsoft.EntityFrameworkCore.SqlServer and Dazinator.Extensions.FileProviders brings in a legacy version of System.Text.Encodings.Web -->
<PackageVersion Include="System.Text.Encodings.Web" Version="9.0.4" />
<!-- NPoco.SqlServer brings in a vulnerable version of Microsoft.Data.SqlClient -->
<PackageVersion Include="Microsoft.Data.SqlClient" Version="6.0.1" />
<!-- Examine.Lucene brings in a vulnerable version of Lucene.Net.Replicator -->
<PackageVersion Include="Lucene.Net.Replicator" Version="4.8.0-beta00017" />
</ItemGroup>
</Project>
+8 -8
View File
@@ -313,8 +313,8 @@ stages:
testFilter: "(FullyQualifiedName~Umbraco.Infrastructure.Service)"
LinuxPart3Of3:
vmImage: "ubuntu-latest"
# Filter tests that are not part of the Umbraco.Infrastructure namespace. So this will run all tests that are not part of the Umbraco.Infrastructure namespace
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure)"
# Filter tests that are not part of the Umbraco.Infrastructure and ManagementApi namespace. So this will run all tests that are not part of the Umbraco.Infrastructure and ManagementApi namespace
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure) & (FullyQualifiedName!~ManagementApi)"
macOSPart1Of3:
vmImage: "macOS-latest"
# Filter tests that are part of the Umbraco.Infrastructure namespace but not part of the Umbraco.Infrastructure.Service namespace
@@ -325,8 +325,8 @@ stages:
testFilter: "(FullyQualifiedName~Umbraco.Infrastructure.Service)"
macOSPart3Of3:
vmImage: "macOS-latest"
# Filter tests that are not part of the Umbraco.Infrastructure namespace.
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure)"
# Filter tests that are not part of the Umbraco.Infrastructure and ManagementApi namespace. So this will run all tests that are not part of the Umbraco.Infrastructure and the ManagementApi namespace
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure) & (FullyQualifiedName!~ManagementApi)"
pool:
vmImage: $(vmImage)
variables:
@@ -389,8 +389,8 @@ stages:
vmImage: "windows-latest"
Tests__Database__DatabaseType: LocalDb
Tests__Database__SQLServerMasterConnectionString: N/A
# Filter tests that are not part of the Umbraco.Infrastructure namespace. So this will run all tests that are not part of the Umbraco.Infrastructure namespace
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure)"
# Filter tests that are not part of the Umbraco.Infrastructure and ManagementApi namespace. So this will run all tests that are not part of the Umbraco.Infrastructure and ManagementApi namespace
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure) & (FullyQualifiedName!~ManagementApi)"
LinuxPart1Of3:
vmImage: "ubuntu-latest"
SA_PASSWORD: UmbracoIntegration123!
@@ -410,8 +410,8 @@ stages:
SA_PASSWORD: UmbracoIntegration123!
Tests__Database__DatabaseType: SqlServer
Tests__Database__SQLServerMasterConnectionString: "Server=(local);User Id=sa;Password=$(SA_PASSWORD);TrustServerCertificate=True"
# Filter tests that are not part of the Umbraco.Infrastructure namespace. So this will run all tests that are not part of the Umbraco.Infrastructure namespace
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure)"
# Filter tests that are not part of the Umbraco.Infrastructure and ManagementApi namespace. So this will run all tests that are not part of the Umbraco.Infrastructure and ManagementApi namespace
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure) & (FullyQualifiedName!~ManagementApi)"
pool:
vmImage: $(vmImage)
steps:
+45 -24
View File
@@ -10,6 +10,7 @@ schedules:
include:
- v15/dev
- main
- v17/dev
parameters:
- name: skipIntegrationTests
@@ -20,7 +21,7 @@ parameters:
- name: differentAppSettingsAcceptanceTests
displayName: Run acceptance tests with different app settings
type: boolean
default: false
default: true
- name: skipDefaultConfigAcceptanceTests
displayName: Skip tests with DefaultConfig
@@ -122,31 +123,39 @@ stages:
matrix:
# Windows:
# vmImage: 'windows-latest'
# We split the tests into 3 parts for each OS to reduce the time it takes to run them on the pipeline
LinuxPart1Of3:
# We split the tests into 4 parts for each OS to reduce the time it takes to run them on the pipeline
LinuxPart1Of4:
vmImage: "ubuntu-latest"
# Filter tests that are part of the Umbraco.Infrastructure namespace but not part of the Umbraco.Infrastructure.Service namespace
testFilter: "(FullyQualifiedName~Umbraco.Infrastructure) & (FullyQualifiedName!~Umbraco.Infrastructure.Service)"
LinuxPart2Of3:
LinuxPart2Of4:
vmImage: "ubuntu-latest"
# Filter tests that are part of the Umbraco.Infrastructure.Service namespace
testFilter: "(FullyQualifiedName~Umbraco.Infrastructure.Service)"
LinuxPart3Of3:
LinuxPart3Of4:
vmImage: "ubuntu-latest"
# Filter tests that are not part of the Umbraco.Infrastructure namespace. So this will run all tests that are not part of the Umbraco.Infrastructure namespace
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure)"
macOSPart1Of3:
# Filter tests that are not part of the Umbraco.Infrastructure and ManagementApi namespace. So this will run all tests that are not part of the Umbraco.Infrastructure namespace
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure) & (FullyQualifiedName!~ManagementApi)"
LinuxPart4Of4:
vmImage: "ubuntu-latest"
# Filter tests that are part of the ManagementApi namespace
testFilter: "(FullyQualifiedName~ManagementApi)"
macOSPart1Of4:
vmImage: "macOS-latest"
# Filter tests that are part of the Umbraco.Infrastructure namespace but not part of the Umbraco.Infrastructure.Service namespace
testFilter: "(FullyQualifiedName~Umbraco.Infrastructure) & (FullyQualifiedName!~Umbraco.Infrastructure.Service)"
macOSPart2Of3:
macOSPart2Of4:
vmImage: "macOS-latest"
# Filter tests that are part of the Umbraco.Infrastructure.Service namespace
testFilter: "(FullyQualifiedName~Umbraco.Infrastructure.Service)"
macOSPart3Of3:
macOSPart3Of4:
vmImage: "macOS-latest"
# Filter tests that are not part of the Umbraco.Infrastructure namespace.
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure)"
# Filter tests that are not part of the Umbraco.Infrastructure and ManagementApi namespace.
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure) & (FullyQualifiedName!~ManagementApi)"
macOSPart4Of4:
vmImage: "macOS-latest"
# Filter tests that are part of the ManagementApi namespace.
testFilter: "(FullyQualifiedName~ManagementApi)"
pool:
vmImage: $(vmImage)
variables:
@@ -186,43 +195,55 @@ stages:
SA_PASSWORD: UmbracoAcceptance123!
strategy:
matrix:
# We split the tests into 3 parts for each OS to reduce the time it takes to run them on the pipeline
WindowsPart1Of3:
# We split the tests into 4 parts for each OS to reduce the time it takes to run them on the pipeline
WindowsPart1Of4:
vmImage: "windows-latest"
Tests__Database__DatabaseType: LocalDb
Tests__Database__SQLServerMasterConnectionString: N/A
# Filter tests that are part of the Umbraco.Infrastructure namespace but not part of the Umbraco.Infrastructure.Service namespace
testFilter: "(FullyQualifiedName~Umbraco.Infrastructure) & (FullyQualifiedName!~Umbraco.Infrastructure.Service)"
WindowsPart2Of3:
WindowsPart2Of4:
vmImage: "windows-latest"
Tests__Database__DatabaseType: LocalDb
Tests__Database__SQLServerMasterConnectionString: N/A
# Filter tests that are part of the Umbraco.Infrastructure.Service namespace
testFilter: "(FullyQualifiedName~Umbraco.Infrastructure.Service)"
WindowsPart3Of3:
WindowsPart3Of4:
vmImage: "windows-latest"
Tests__Database__DatabaseType: LocalDb
Tests__Database__SQLServerMasterConnectionString: N/A
# Filter tests that are not part of the Umbraco.Infrastructure namespace. So this will run all tests that are not part of the Umbraco.Infrastructure namespace
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure)"
LinuxPart1Of3:
# Filter tests that are not part of the Umbraco.Infrastructure and ManagementApi namespace.
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure) & (FullyQualifiedName!~ManagementApi)"
WindowsPart4Of4:
vmImage: "windows-latest"
Tests__Database__DatabaseType: LocalDb
Tests__Database__SQLServerMasterConnectionString: N/A
# Filter tests that are part of the ManagementApi namespace.
testFilter: "(FullyQualifiedName~ManagementApi)"
LinuxPart1Of4:
vmImage: "ubuntu-latest"
Tests__Database__DatabaseType: SqlServer
Tests__Database__SQLServerMasterConnectionString: "Server=(local);User Id=sa;Password=$(SA_PASSWORD);Encrypt=True;TrustServerCertificate=True"
# Filter tests that are part of the Umbraco.Infrastructure namespace but not part of the Umbraco.Infrastructure.Service namespace
testFilter: "(FullyQualifiedName~Umbraco.Infrastructure) & (FullyQualifiedName!~Umbraco.Infrastructure.Service)"
LinuxPart2Of3:
LinuxPart2Of4:
vmImage: "ubuntu-latest"
Tests__Database__DatabaseType: SqlServer
Tests__Database__SQLServerMasterConnectionString: "Server=(local);User Id=sa;Password=$(SA_PASSWORD);Encrypt=True;TrustServerCertificate=True"
# Filter tests that are part of the Umbraco.Infrastructure.Service namespace
testFilter: "(FullyQualifiedName~Umbraco.Infrastructure.Service)"
LinuxPart3Of3:
LinuxPart3Of4:
vmImage: "ubuntu-latest"
Tests__Database__DatabaseType: SqlServer
Tests__Database__SQLServerMasterConnectionString: "Server=(local);User Id=sa;Password=$(SA_PASSWORD);Encrypt=True;TrustServerCertificate=True"
# Filter tests that are not part of the Umbraco.Infrastructure namespace. So this will run all tests that are not part of the Umbraco.Infrastructure namespace
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure)"
# Filter tests that are not part of the Umbraco.Infrastructure and ManagementApi namespace.
testFilter: "(FullyQualifiedName!~Umbraco.Infrastructure) & (FullyQualifiedName!~ManagementApi)"
LinuxPart4Of4:
vmImage: "ubuntu-latest"
Tests__Database__DatabaseType: SqlServer
Tests__Database__SQLServerMasterConnectionString: "Server=(local);User Id=sa;Password=$(SA_PASSWORD);Encrypt=True;TrustServerCertificate=True"
# Filter tests that are part of the ManagementApi namespace.
testFilter: "(FullyQualifiedName~ManagementApi)"
pool:
vmImage: $(vmImage)
steps:
@@ -484,7 +505,7 @@ stages:
jobs:
- job:
displayName: E2E Tests with Different App settings (SQL Server)
condition: ${{ or(eq(parameters.differentAppSettingsAcceptanceTests, true), eq(parameters.skipDefaultConfigAcceptanceTests, true)) }}
condition: ${{ eq(parameters.differentAppSettingsAcceptanceTests, true) }}
timeoutInMinutes: 180
variables:
SA_PASSWORD: UmbracoAcceptance123!
+2 -2
View File
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "9.0.100",
"version": "10.0.100-rc.2.25502.107",
"rollForward": "latestFeature",
"allowPrerelease": false
"allowPrerelease": true
}
}
@@ -9,8 +9,8 @@ using Umbraco.Cms.Api.Common.Security;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Infrastructure.BackgroundJobs.Jobs;
using Umbraco.Extensions;
using Umbraco.Cms.Infrastructure.BackgroundJobs;
using Umbraco.Cms.Infrastructure.BackgroundJobs.Jobs.DistributedJobs;
namespace Umbraco.Cms.Api.Common.DependencyInjection;
@@ -139,7 +139,7 @@ public static class UmbracoBuilderAuthExtensions
});
});
builder.Services.AddRecurringBackgroundJob<OpenIddictCleanupJob>();
builder.Services.AddSingleton<IDistributedBackgroundJob, OpenIddictCleanupJob>();
builder.Services.ConfigureOptions<ConfigureOpenIddict>();
}
}
@@ -8,11 +8,11 @@ namespace Umbraco.Extensions;
public static class MethodInfoApiCommonExtensions
{
public static string? GetMapToApiVersionAttributeValue(this MethodInfo methodInfo)
public static string GetMapToApiVersionAttributeValue(this MethodInfo methodInfo)
{
MapToApiVersionAttribute[] mapToApis = methodInfo.GetCustomAttributes(typeof(MapToApiVersionAttribute), inherit: true).Cast<MapToApiVersionAttribute>().ToArray();
return string.Join("|", mapToApis.SelectMany(x=>x.Versions));
return string.Join("|", mapToApis.SelectMany(x => x.Versions));
}
public static string? GetMapToApiAttributeValue(this MethodInfo methodInfo)
@@ -15,20 +15,6 @@ public class SubTypesSelector : ISubTypesSelector
private readonly IEnumerable<ISubTypesHandler> _subTypeHandlers;
private readonly IUmbracoJsonTypeInfoResolver _umbracoJsonTypeInfoResolver;
[Obsolete("The settings parameter is not required anymore, use the other constructor instead. Scheduled for removal in Umbraco 17.")]
public SubTypesSelector(
IOptions<GlobalSettings> settings,
IHostingEnvironment hostingEnvironment,
IHttpContextAccessor httpContextAccessor,
IEnumerable<ISubTypesHandler> subTypeHandlers,
IUmbracoJsonTypeInfoResolver umbracoJsonTypeInfoResolver)
{
_hostingEnvironment = hostingEnvironment;
_httpContextAccessor = httpContextAccessor;
_subTypeHandlers = subTypeHandlers;
_umbracoJsonTypeInfoResolver = umbracoJsonTypeInfoResolver;
}
public SubTypesSelector(
IHostingEnvironment hostingEnvironment,
IHttpContextAccessor httpContextAccessor,
@@ -16,11 +16,6 @@
<PackageReference Include="OpenIddict.AspNetCore" />
</ItemGroup>
<ItemGroup>
<!-- Take top-level depedendency on OpenIddict.AspNetCore depends on a vulnerable version -->
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj" />
<ProjectReference Include="..\Umbraco.Web.Common\Umbraco.Web.Common.csproj" />
@@ -1,8 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.DeliveryApi;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Extensions;
namespace Umbraco.Cms.Api.Delivery.Querying;
@@ -14,30 +11,6 @@ public abstract class QueryOptionBase
private readonly IApiDocumentUrlService _apiDocumentUrlService;
private readonly IVariationContextAccessor _variationContextAccessor;
[Obsolete("Please use the non-obsolete constructor. Will be removed in V17.")]
public QueryOptionBase(
IPublishedContentCache publishedContentCache,
IRequestRoutingService requestRoutingService)
: this(
requestRoutingService,
StaticServiceProvider.Instance.GetRequiredService<IRequestPreviewService>(),
StaticServiceProvider.Instance.GetRequiredService<IApiDocumentUrlService>(),
StaticServiceProvider.Instance.GetRequiredService<IVariationContextAccessor>())
{
}
[Obsolete("Please use the non-obsolete constructor. Will be removed in V17.")]
public QueryOptionBase(
IPublishedContentCache publishedContentCache,
IRequestRoutingService requestRoutingService,
IRequestPreviewService requestPreviewService,
IRequestCultureService requestCultureService,
IApiDocumentUrlService apiDocumentUrlService,
IVariationContextAccessor variationContextAccessor)
: this(requestRoutingService, requestPreviewService, apiDocumentUrlService, variationContextAccessor)
{
}
public QueryOptionBase(
IRequestRoutingService requestRoutingService,
IRequestPreviewService requestPreviewService,
@@ -1,9 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Api.Delivery.Indexing.Selectors;
using Umbraco.Cms.Core.DeliveryApi;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Core.Services.Navigation;
namespace Umbraco.Cms.Api.Delivery.Querying.Selectors;
@@ -13,46 +10,6 @@ public sealed class AncestorsSelector : QueryOptionBase, ISelectorHandler
private readonly IDocumentNavigationQueryService _navigationQueryService;
private const string AncestorsSpecifier = "ancestors:";
[Obsolete("Please use the non-obsolete constructor. Will be removed in V17.")]
public AncestorsSelector(
IPublishedContentCache publishedContentCache,
IRequestRoutingService requestRoutingService,
IDocumentNavigationQueryService navigationQueryService,
IRequestPreviewService requestPreviewService)
: this(
requestRoutingService,
requestPreviewService,
StaticServiceProvider.Instance.GetRequiredService<IApiDocumentUrlService>(),
StaticServiceProvider.Instance.GetRequiredService<IVariationContextAccessor>(),
navigationQueryService)
{
}
[Obsolete("Please use the non-obsolete constructor. Will be removed in V17.")]
public AncestorsSelector(
IPublishedContentCache publishedContentCache,
IRequestRoutingService requestRoutingService,
IDocumentNavigationQueryService navigationQueryService)
: this(
requestRoutingService,
StaticServiceProvider.Instance.GetRequiredService<IRequestPreviewService>(),
StaticServiceProvider.Instance.GetRequiredService<IApiDocumentUrlService>(),
StaticServiceProvider.Instance.GetRequiredService<IVariationContextAccessor>(),
navigationQueryService)
{
}
[Obsolete("Use the constructor that takes all parameters. Scheduled for removal in V17.")]
public AncestorsSelector(IPublishedContentCache publishedContentCache, IRequestRoutingService requestRoutingService)
: this(
requestRoutingService,
StaticServiceProvider.Instance.GetRequiredService<IRequestPreviewService>(),
StaticServiceProvider.Instance.GetRequiredService<IApiDocumentUrlService>(),
StaticServiceProvider.Instance.GetRequiredService<IVariationContextAccessor>(),
StaticServiceProvider.Instance.GetRequiredService<IDocumentNavigationQueryService>())
{
}
public AncestorsSelector(
IRequestRoutingService requestRoutingService,
IRequestPreviewService requestPreviewService,
@@ -62,18 +19,6 @@ public sealed class AncestorsSelector : QueryOptionBase, ISelectorHandler
: base(requestRoutingService, requestPreviewService, apiDocumentUrlService, variationContextAccessor)
=> _navigationQueryService = navigationQueryService;
[Obsolete("Use the constructor that takes all parameters. Scheduled for removal in V17.")]
public AncestorsSelector(
IRequestRoutingService requestRoutingService,
IPublishedContentCache publishedContentCache,
IRequestPreviewService requestPreviewService,
IApiDocumentUrlService apiDocumentUrlService,
IVariationContextAccessor variationContextAccessor,
IDocumentNavigationQueryService navigationQueryService)
: this(requestRoutingService, requestPreviewService, apiDocumentUrlService, variationContextAccessor, navigationQueryService)
{
}
/// <inheritdoc />
public bool CanHandle(string query)
=> query.StartsWith(AncestorsSpecifier, StringComparison.OrdinalIgnoreCase);
@@ -12,27 +12,6 @@ public sealed class ChildrenSelector : QueryOptionBase, ISelectorHandler
{
private const string ChildrenSpecifier = "children:";
[Obsolete("Please use the non-obsolete constructor. Will be removed in V17.")]
public ChildrenSelector(IPublishedContentCache publishedContentCache, IRequestRoutingService requestRoutingService)
: this(
requestRoutingService,
StaticServiceProvider.Instance.GetRequiredService<IRequestPreviewService>(),
StaticServiceProvider.Instance.GetRequiredService<IApiDocumentUrlService>(),
StaticServiceProvider.Instance.GetRequiredService<IVariationContextAccessor>())
{
}
[Obsolete("Please use the non-obsolete constructor. Will be removed in V17.")]
public ChildrenSelector(
IPublishedContentCache publishedContentCache,
IRequestRoutingService requestRoutingService,
IRequestPreviewService requestPreviewService,
IApiDocumentUrlService apiDocumentUrlService,
IVariationContextAccessor variationContextAccessor)
: this(requestRoutingService, requestPreviewService, apiDocumentUrlService, variationContextAccessor)
{
}
public ChildrenSelector(
IRequestRoutingService requestRoutingService,
IRequestPreviewService requestPreviewService,
@@ -12,27 +12,6 @@ public sealed class DescendantsSelector : QueryOptionBase, ISelectorHandler
{
private const string DescendantsSpecifier = "descendants:";
[Obsolete("Please use the non-obsolete constructor. Will be removed in V17.")]
public DescendantsSelector(IPublishedContentCache publishedContentCache, IRequestRoutingService requestRoutingService)
: this(
requestRoutingService,
StaticServiceProvider.Instance.GetRequiredService<IRequestPreviewService>(),
StaticServiceProvider.Instance.GetRequiredService<IApiDocumentUrlService>(),
StaticServiceProvider.Instance.GetRequiredService<IVariationContextAccessor>())
{
}
[Obsolete("Please use the non-obsolete constructor. Will be removed in V17.")]
public DescendantsSelector(
IPublishedContentCache publishedContentCache,
IRequestRoutingService requestRoutingService,
IRequestPreviewService requestPreviewService,
IApiDocumentUrlService apiDocumentUrlService,
IVariationContextAccessor variationContextAccessor)
: this(requestRoutingService, requestPreviewService, apiDocumentUrlService, variationContextAccessor)
{
}
public DescendantsSelector(
IRequestRoutingService requestRoutingService,
IRequestPreviewService requestPreviewService,
@@ -66,9 +66,14 @@ internal sealed class DeliveryApiItemsEndpointsMatcherPolicy : MatcherPolicy, IE
{
ApiVersion[]? supportedApiVersions = endpoint.Metadata.GetMetadata<MapToApiVersionAttribute>()?.Versions.ToArray();
// if the endpoint is versioned, the requested API version must be among the API versions supported by the endpoint.
// if the endpoint is NOT versioned, it cannot be used with a requested API version
return supportedApiVersions?.Contains(requestedApiVersion) ?? requestedApiVersion is null;
// If the endpoint is versioned, the requested API version must be among the API versions supported by the endpoint.
// If the endpoint is NOT versioned, it cannot be used with a requested API version.
if (supportedApiVersions is not null && requestedApiVersion is not null)
{
return supportedApiVersions.Contains(requestedApiVersion);
}
return requestedApiVersion is null;
}
private static bool IsByIdsController(ControllerActionDescriptor? controllerActionDescriptor)
@@ -66,7 +66,7 @@ internal sealed class ApiMediaQueryService : IApiMediaQueryService
private IPublishedContent? TryGetByPath(string path, IPublishedMediaCache mediaCache)
{
var segments = path.Split(Constants.CharArrays.ForwardSlash, StringSplitOptions.RemoveEmptyEntries);
IEnumerable<IPublishedContent> currentChildren = mediaCache.GetAtRoot();
IEnumerable<IPublishedContent> currentChildren = GetRootContent(mediaCache);
IPublishedContent? resolvedMedia = null;
foreach (var segment in segments)
@@ -103,7 +103,7 @@ internal sealed class ApiMediaQueryService : IApiMediaQueryService
IPublishedMediaCache mediaCache = GetRequiredPublishedMediaCache();
if (childrenOf.Trim(Constants.CharArrays.ForwardSlash).Length == 0)
{
return mediaCache.GetAtRoot();
return GetRootContent(mediaCache);
}
IPublishedContent? parent = Guid.TryParse(childrenOf, out Guid parentKey)
@@ -196,4 +196,8 @@ internal sealed class ApiMediaQueryService : IApiMediaQueryService
return Attempt.SucceedWithStatus(ApiMediaQueryOperationStatus.Success, result);
}
private IEnumerable<IPublishedContent> GetRootContent(IPublishedMediaCache mediaCache)
=> _mediaNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys) is false ? []
: rootKeys.Select(x => mediaCache.GetById(false, x)).WhereNotNull();
}
@@ -19,12 +19,6 @@ internal sealed partial class RequestCultureService : RequestHeaderHandler, IReq
return ValidLanguageHeaderRegex().IsMatch(acceptLanguage) ? acceptLanguage : null;
}
[Obsolete("Use IVariationContextAccessor to manipulate the variation context. Scheduled for removal in V17.")]
public void SetRequestCulture(string culture)
{
// no-op
}
// at the time of writing we're introducing this to get rid of accept-language header values like "en-GB,en-US;q=0.9,en;q=0.8",
// so we don't want to be too restrictive in this regex - keep it simple for now.
[GeneratedRegex(@"^[\w-]*$")]
@@ -3,6 +3,7 @@
<Title>Umbraco CMS - Delivery API</Title>
<Description>Contains the presentation layer for the Umbraco CMS Delivery API.</Description>
</PropertyGroup>
<PropertyGroup>
<!--
TODO: Fix and remove overrides:
@@ -11,11 +12,18 @@
-->
<WarningsNotAsErrors>$(WarningsNotAsErrors),ASP0019,CS0618,CS0612</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Cms.Api.Common\Umbraco.Cms.Api.Common.csproj" />
<ProjectReference Include="..\Umbraco.Web.Common\Umbraco.Web.Common.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Linq.Async">
<ExcludeAssets>compile</ExcludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Tests.UnitTests</_Parameter1>
@@ -5,6 +5,7 @@ using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Microsoft.Net.Http.Headers;
using Umbraco.Cms.Api.Management.Security;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Configuration.Models;
@@ -219,10 +220,44 @@ public class ConfigureBackOfficeCookieOptions : IConfigureNamedOptions<CookieAut
}
return Task.CompletedTask;
}
},
// FIXME: We want to change this over to using an attribute on the backoffice controllers
// See this for more: https://github.com/dotnet/aspnetcore/issues/63093#issuecomment-3201530217
OnRedirectToLogin = context =>
{
if (IsXhr(context.Request))
{
context.Response.Headers.Location = context.RedirectUri;
context.Response.StatusCode = 401;
}
else
{
context.Response.Redirect(context.RedirectUri);
}
return Task.CompletedTask;
},
OnRedirectToAccessDenied = context =>
{
if (IsXhr(context.Request))
{
context.Response.Headers.Location = context.RedirectUri;
context.Response.StatusCode = 403;
}
else
{
context.Response.Redirect(context.RedirectUri);
}
return Task.CompletedTask;
},
};
}
private bool IsXhr(HttpRequest request) =>
string.Equals(request.Query[HeaderNames.XRequestedWith], "XMLHttpRequest", StringComparison.Ordinal) ||
string.Equals(request.Headers.XRequestedWith, "XMLHttpRequest", StringComparison.Ordinal);
/// <summary>
/// Ensures the ticket is renewed if the <see cref="SecuritySettings.KeepUserLoggedIn" /> is set to true
/// and the current request is for the get user seconds endpoint
@@ -29,39 +29,6 @@ public abstract class ContentCollectionControllerBase<TContent, TCollectionRespo
_flagProviders = flagProvider;
}
[Obsolete("Use the constructer with all parameters. To be removed in Umbraco 18")]
protected ContentCollectionControllerBase(IUmbracoMapper mapper)
: this(mapper, StaticServiceProvider.Instance.GetRequiredService<FlagProviderCollection>())
{
}
[Obsolete("This method is no longer used and will be removed in Umbraco 17.")]
protected IActionResult CollectionResult(ListViewPagedModel<TContent> result)
{
PagedModel<TContent> collectionItemsResult = result.Items;
ListViewConfiguration collectionConfiguration = result.ListViewConfiguration;
var collectionPropertyAliases = collectionConfiguration
.IncludeProperties
.Select(p => p.Alias)
.WhereNotNull()
.ToArray();
List<TCollectionResponseModel> collectionResponseModels =
_mapper.MapEnumerable<TContent, TCollectionResponseModel>(collectionItemsResult.Items, context =>
{
context.SetIncludedProperties(collectionPropertyAliases);
});
var pageViewModel = new PagedViewModel<TCollectionResponseModel>
{
Items = collectionResponseModels,
Total = collectionItemsResult.Total,
};
return Ok(pageViewModel);
}
/// <summary>
/// Creates a collection result from the provided collection response models and total number of items.
/// </summary>
@@ -1,40 +0,0 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Api.Management.Factories;
using Umbraco.Cms.Api.Management.ViewModels.DataType;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Services.OperationStatus;
namespace Umbraco.Cms.Api.Management.Controllers.DataType;
[ApiVersion("1.0")]
[Obsolete("Please use ReferencedByDataTypeController and the referenced-by endpoint. Scheduled for removal in Umbraco 17.")]
public class ReferencesDataTypeController : DataTypeControllerBase
{
private readonly IDataTypeService _dataTypeService;
private readonly IDataTypeReferencePresentationFactory _dataTypeReferencePresentationFactory;
public ReferencesDataTypeController(IDataTypeService dataTypeService, IDataTypeReferencePresentationFactory dataTypeReferencePresentationFactory)
{
_dataTypeService = dataTypeService;
_dataTypeReferencePresentationFactory = dataTypeReferencePresentationFactory;
}
[HttpGet("{id:guid}/references")]
[MapToApiVersion("1.0")]
[ProducesResponseType(typeof(DataTypeReferenceResponseModel[]), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
public async Task<IActionResult> References(CancellationToken cancellationToken, Guid id)
{
Attempt<IReadOnlyDictionary<Udi, IEnumerable<string>>, DataTypeOperationStatus> result = await _dataTypeService.GetReferencesAsync(id);
if (result.Success == false)
{
return DataTypeOperationStatusResult(result.Status);
}
DataTypeReferenceResponseModel[] viewModels = _dataTypeReferencePresentationFactory.CreateDataTypeReferenceViewModels(result.Result).ToArray();
return Ok(viewModels);
}
}
@@ -2,13 +2,10 @@ using Asp.Versioning;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Api.Management.Factories;
using Umbraco.Cms.Api.Management.ViewModels.Document;
using Umbraco.Cms.Core.Actions;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Security.Authorization;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Services.Querying;
using Umbraco.Cms.Web.Common.Authorization;
using Umbraco.Extensions;
@@ -22,31 +19,6 @@ public class ByKeyDocumentController : DocumentControllerBase
private readonly IDocumentPresentationFactory _documentPresentationFactory;
private readonly IContentQueryService _contentQueryService;
[Obsolete("Scheduled for removal in v17")]
public ByKeyDocumentController(
IAuthorizationService authorizationService,
IContentEditingService contentEditingService,
IDocumentPresentationFactory documentPresentationFactory)
{
_authorizationService = authorizationService;
_documentPresentationFactory = documentPresentationFactory;
_contentQueryService = StaticServiceProvider.Instance.GetRequiredService<IContentQueryService>();
}
// needed for greedy selection until other constructor remains in v17
[Obsolete("Scheduled for removal in v17")]
public ByKeyDocumentController(
IAuthorizationService authorizationService,
IContentEditingService contentEditingService,
IDocumentPresentationFactory documentPresentationFactory,
IContentQueryService contentQueryService)
{
_authorizationService = authorizationService;
_documentPresentationFactory = documentPresentationFactory;
_contentQueryService = contentQueryService;
}
[ActivatorUtilitiesConstructor]
public ByKeyDocumentController(
IAuthorizationService authorizationService,
IDocumentPresentationFactory documentPresentationFactory,
@@ -23,12 +23,6 @@ public abstract class DocumentCollectionControllerBase : ContentCollectionContro
{
}
[Obsolete("Please use the constructor with all parameters. Scheduled to be removed in V18")]
protected DocumentCollectionControllerBase(IUmbracoMapper mapper)
: base(mapper)
{
}
protected IActionResult CollectionOperationStatusResult(ContentCollectionOperationStatus status)
=> ContentCollectionOperationStatusResult(status, "document");
}
@@ -0,0 +1,53 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Api.Common.Builders;
using Umbraco.Cms.Api.Management.Factories;
using Umbraco.Cms.Api.Management.ViewModels.Document;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Api.Management.Controllers.Document;
[ApiVersion("1.0")]
public class DocumentPreviewUrlController : DocumentControllerBase
{
private readonly IContentService _contentService;
private readonly IDocumentUrlFactory _documentUrlFactory;
public DocumentPreviewUrlController(
IContentService contentService,
IDocumentUrlFactory documentUrlFactory)
{
_contentService = contentService;
_documentUrlFactory = documentUrlFactory;
}
[MapToApiVersion("1.0")]
[HttpGet("{id:guid}/preview-url")]
[ProducesResponseType(typeof(DocumentUrlInfo), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
public async Task<IActionResult> GetPreviewUrl(Guid id, string providerAlias, string? culture, string? segment)
{
IContent? content = _contentService.GetById(id);
if (content is null)
{
return NotFound(new ProblemDetailsBuilder()
.WithTitle("Document not found")
.WithDetail("The requested document did not exist.")
.Build());
}
DocumentUrlInfo? previewUrlInfo = await _documentUrlFactory.GetPreviewUrlAsync(content, providerAlias, culture, segment);
if (previewUrlInfo is null)
{
return BadRequest(new ProblemDetailsBuilder()
.WithTitle("No preview URL for document")
.WithDetail("Failed to produce a preview URL for the requested document.")
.Build());
}
return Ok(previewUrlInfo);
}
}
@@ -21,20 +21,6 @@ public class ValidateCreateDocumentController : CreateDocumentControllerBase
private readonly IContentEditingService _contentEditingService;
private readonly IBackOfficeSecurityAccessor _backOfficeSecurityAccessor;
[Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 17.")]
public ValidateCreateDocumentController(
IAuthorizationService authorizationService,
IDocumentEditingPresentationFactory documentEditingPresentationFactory,
IContentEditingService contentEditingService)
: this(
authorizationService,
documentEditingPresentationFactory,
contentEditingService,
StaticServiceProvider.Instance.GetRequiredService<IBackOfficeSecurityAccessor>())
{
}
[ActivatorUtilitiesConstructor]
public ValidateCreateDocumentController(
IAuthorizationService authorizationService,
IDocumentEditingPresentationFactory documentEditingPresentationFactory,
@@ -21,20 +21,6 @@ public class ValidateUpdateDocumentController : UpdateDocumentControllerBase
private readonly IDocumentEditingPresentationFactory _documentEditingPresentationFactory;
private readonly IBackOfficeSecurityAccessor _backOfficeSecurityAccessor;
[Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 17.")]
public ValidateUpdateDocumentController(
IAuthorizationService authorizationService,
IContentEditingService contentEditingService,
IDocumentEditingPresentationFactory documentEditingPresentationFactory)
: this(
authorizationService,
contentEditingService,
documentEditingPresentationFactory,
StaticServiceProvider.Instance.GetRequiredService<IBackOfficeSecurityAccessor>())
{
}
[ActivatorUtilitiesConstructor]
public ValidateUpdateDocumentController(
IAuthorizationService authorizationService,
IContentEditingService contentEditingService,
@@ -16,35 +16,12 @@ public class SearchDocumentTypeItemController : DocumentTypeItemControllerBase
private readonly IUmbracoMapper _mapper;
private readonly IContentTypeSearchService _contentTypeSearchService;
[Obsolete("Please use ctor that only accepts IUmbracoMapper & IContentTypeSearchService, scheduled for removal in v17")]
public SearchDocumentTypeItemController(IEntitySearchService entitySearchService, IContentTypeService contentTypeService, IUmbracoMapper mapper)
: this(mapper, StaticServiceProvider.Instance.GetRequiredService<IContentTypeSearchService>())
{
}
[Obsolete("Please use ctor that only accepts IUmbracoMapper & IContentTypeSearchService, scheduled for removal in v17")]
// We need to have this constructor, or else we get ambiguous constructor error
public SearchDocumentTypeItemController(
IEntitySearchService entitySearchService,
IContentTypeService contentTypeService,
IUmbracoMapper mapper,
IContentTypeSearchService contentTypeSearchService)
: this(mapper, contentTypeSearchService)
{
}
[ActivatorUtilitiesConstructor]
public SearchDocumentTypeItemController(IUmbracoMapper mapper, IContentTypeSearchService contentTypeSearchService)
{
_mapper = mapper;
_contentTypeSearchService = contentTypeSearchService;
}
[NonAction]
[Obsolete("Scheduled to be removed in v16, use the non obsoleted method instead")]
public async Task<IActionResult> Search(CancellationToken cancellationToken, string query, int skip = 0, int take = 100)
=> await SearchDocumentType(cancellationToken, query, null, skip, take);
[HttpGet("search")]
[MapToApiVersion("1.0")]
[ProducesResponseType(typeof(PagedModel<DocumentTypeItemResponseModel>), StatusCodes.Status200OK)]
@@ -26,9 +26,9 @@ public class RebuildIndexerController : IndexerControllerBase
}
/// <summary>
/// Rebuilds the index
/// Rebuilds the index.
/// </summary>
/// <param name="indexName"></param>
/// <param name="indexName">The name of the index to rebuild.</param>
/// <returns></returns>
[HttpPost("{indexName}/rebuild")]
[MapToApiVersion("1.0")]
@@ -36,7 +36,7 @@ public class RebuildIndexerController : IndexerControllerBase
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status409Conflict)]
[ProducesResponseType(StatusCodes.Status200OK)]
public Task<IActionResult> Rebuild(CancellationToken cancellationToken, string indexName)
public async Task<IActionResult> Rebuild(CancellationToken cancellationToken, string indexName)
{
if (!_examineManager.TryGetIndex(indexName, out IIndex? index))
{
@@ -48,7 +48,7 @@ public class RebuildIndexerController : IndexerControllerBase
Type = "Error",
};
return Task.FromResult<IActionResult>(NotFound(invalidModelProblem));
return NotFound(invalidModelProblem);
}
if (!_indexingRebuilderService.CanRebuild(index.Name))
@@ -57,19 +57,19 @@ public class RebuildIndexerController : IndexerControllerBase
{
Title = "Could not validate the populator",
Detail =
$"The index {index?.Name} could not be rebuilt because we could not validate its associated {typeof(IIndexPopulator)}",
$"The index {index.Name} could not be rebuilt because we could not validate its associated {typeof(IIndexPopulator)}",
Status = StatusCodes.Status400BadRequest,
Type = "Error",
};
return Task.FromResult<IActionResult>(BadRequest(invalidModelProblem));
return BadRequest(invalidModelProblem);
}
_logger.LogInformation("Rebuilding index '{IndexName}'", indexName);
if (_indexingRebuilderService.TryRebuild(index, indexName))
if (await _indexingRebuilderService.TryRebuildAsync(index, indexName))
{
return Task.FromResult<IActionResult>(Ok());
return Ok();
}
var problemDetails = new ProblemDetails
@@ -80,6 +80,6 @@ public class RebuildIndexerController : IndexerControllerBase
Type = "Error",
};
return Task.FromResult<IActionResult>(Conflict(problemDetails));
return Conflict(problemDetails);
}
}
@@ -26,12 +26,6 @@ public abstract class MediaCollectionControllerBase : ContentCollectionControlle
{
}
[Obsolete("Please use the constructor with all parameters. Scheduled to be removed in Umbraco 18")]
protected MediaCollectionControllerBase(IUmbracoMapper mapper)
: base(mapper)
{
}
protected IActionResult CollectionOperationStatusResult(ContentCollectionOperationStatus status)
=> ContentCollectionOperationStatusResult(status, "media");
}
@@ -24,15 +24,15 @@ public class SearchMemberItemController : MemberItemControllerBase
[HttpGet("search")]
[MapToApiVersion("1.0")]
[ProducesResponseType(typeof(PagedModel<MemberItemResponseModel>), StatusCodes.Status200OK)]
public Task<IActionResult> SearchWithAllowedTypes(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, [FromQuery]IEnumerable<Guid>? allowedMemberTypes = null)
public async Task<IActionResult> SearchWithAllowedTypes(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, [FromQuery]IEnumerable<Guid>? allowedMemberTypes = null)
{
PagedModel<IEntitySlim> searchResult = _indexedEntitySearchService.Search(UmbracoObjectTypes.Member, query, null, allowedMemberTypes, skip, take);
PagedModel<IEntitySlim> searchResult = await _indexedEntitySearchService.SearchAsync(UmbracoObjectTypes.Member, query, null, allowedMemberTypes, false, "*", skip, take);
var result = new PagedModel<MemberItemResponseModel>
{
Items = searchResult.Items.OfType<IMemberEntitySlim>().Select(_memberPresentationFactory.CreateItemResponseModel),
Total = searchResult.Total
Total = searchResult.Total,
};
return Task.FromResult<IActionResult>(Ok(result));
return await Task.FromResult<IActionResult>(Ok(result));
}
}
@@ -0,0 +1,25 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Api.Management.ViewModels.Folder;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Api.Management.Controllers.MemberType.Folder;
[ApiVersion("1.0")]
public class ByKeyMemberTypeFolderController : MemberTypeFolderControllerBase
{
public ByKeyMemberTypeFolderController(
IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
IMemberTypeContainerService memberTypeContainerService)
: base(backOfficeSecurityAccessor, memberTypeContainerService)
{
}
[HttpGet("{id:guid}")]
[MapToApiVersion("1.0")]
[ProducesResponseType(typeof(FolderResponseModel), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
public async Task<IActionResult> ByKey(CancellationToken cancellationToken, Guid id) => await GetFolderAsync(id);
}
@@ -0,0 +1,31 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Api.Management.ViewModels.Folder;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Api.Management.Controllers.MemberType.Folder;
[ApiVersion("1.0")]
public class CreateMemberTypeFolderController : MemberTypeFolderControllerBase
{
public CreateMemberTypeFolderController(
IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
IMemberTypeContainerService memberTypeContainerService)
: base(backOfficeSecurityAccessor, memberTypeContainerService)
{
}
[HttpPost]
[MapToApiVersion("1.0")]
[ProducesResponseType(StatusCodes.Status201Created)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
public async Task<IActionResult> Create(
CancellationToken cancellationToken,
CreateFolderRequestModel createFolderRequestModel)
=> await CreateFolderAsync<ByKeyMemberTypeFolderController>(
createFolderRequestModel,
controller => nameof(controller.ByKey)).ConfigureAwait(false);
}
@@ -0,0 +1,25 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Api.Management.Controllers.MemberType.Folder;
[ApiVersion("1.0")]
public class DeleteMemberTypeFolderController : MemberTypeFolderControllerBase
{
public DeleteMemberTypeFolderController(
IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
IMemberTypeContainerService memberTypeContainerService)
: base(backOfficeSecurityAccessor, memberTypeContainerService)
{
}
[HttpDelete("{id:guid}")]
[MapToApiVersion("1.0")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
public async Task<IActionResult> Delete(CancellationToken cancellationToken, Guid id) => await DeleteFolderAsync(id);
}
@@ -0,0 +1,23 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Api.Management.Routing;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Web.Common.Authorization;
namespace Umbraco.Cms.Api.Management.Controllers.MemberType.Folder;
[VersionedApiBackOfficeRoute($"{Constants.UdiEntityType.MemberType}/folder")]
[ApiExplorerSettings(GroupName = "Member Type")]
[Authorize(Policy = AuthorizationPolicies.TreeAccessMemberTypes)]
public abstract class MemberTypeFolderControllerBase : FolderManagementControllerBase<IMemberType>
{
protected MemberTypeFolderControllerBase(
IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
IMemberTypeContainerService memberTypeContainerService)
: base(backOfficeSecurityAccessor, memberTypeContainerService)
{
}
}
@@ -0,0 +1,30 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Api.Management.ViewModels.Folder;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Api.Management.Controllers.MemberType.Folder;
[ApiVersion("1.0")]
public class UpdateMemberTypeFolderController : MemberTypeFolderControllerBase
{
public UpdateMemberTypeFolderController(
IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
IMemberTypeContainerService memberTypeContainerService)
: base(backOfficeSecurityAccessor, memberTypeContainerService)
{
}
[HttpPut("{id:guid}")]
[MapToApiVersion("1.0")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
public async Task<IActionResult> Update(
CancellationToken cancellationToken,
Guid id,
UpdateFolderResponseModel updateFolderResponseModel)
=> await UpdateFolderAsync(id, updateFolderResponseModel);
}
@@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Infrastructure.ModelsBuilder;
using Umbraco.Cms.Infrastructure.ModelsBuilder.Building;
@@ -39,7 +40,8 @@ public class BuildModelsBuilderController : ModelsBuilderControllerBase
{
try
{
if (!_modelsBuilderSettings.ModelsMode.SupportsExplicitGeneration())
if (_modelsBuilderSettings.ModelsMode != Constants.ModelsBuilder.ModelsModes.SourceCodeManual
&& _modelsBuilderSettings.ModelsMode != Constants.ModelsBuilder.ModelsModes.SourceCodeAuto)
{
var problemDetailsModel = new ProblemDetails
{
@@ -0,0 +1,22 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Api.Management.Services.NewsDashboard;
using Umbraco.Cms.Api.Management.ViewModels.NewsDashboard;
namespace Umbraco.Cms.Api.Management.Controllers.NewsDashboard;
public class NewsDashboardController : NewsDashboardControllerBase
{
private readonly INewsDashboardService _newsDashboardService;
public NewsDashboardController(INewsDashboardService newsDashboardService) => _newsDashboardService = newsDashboardService;
[HttpGet]
[ProducesResponseType(typeof(NewsDashboardResponseModel), StatusCodes.Status200OK)]
public async Task<IActionResult> GetDashboard()
{
NewsDashboardResponseModel content = await _newsDashboardService.GetItemsAsync();
return Ok(content);
}
}
@@ -0,0 +1,10 @@
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Api.Management.Routing;
namespace Umbraco.Cms.Api.Management.Controllers.NewsDashboard;
[VersionedApiBackOfficeRoute("news-dashboard")]
[ApiExplorerSettings(GroupName = "News Dashboard")]
public abstract class NewsDashboardControllerBase : ManagementApiControllerBase
{
}
@@ -7,6 +7,7 @@ using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Api.Management.Controllers.Preview;
[ApiVersion("1.0")]
[Obsolete("Do not use this. Preview state is initiated implicitly by the preview URL generation. Scheduled for removal in V18.")]
public class EnterPreviewController : PreviewControllerBase
{
private readonly IPreviewService _previewService;
@@ -254,7 +254,7 @@ public class BackOfficeController : SecurityControllerBase
if (associatedUser is not null)
{
// log current datetime as last login (this also ensures that the user is not flagged as inactive)
associatedUser.LastLoginDateUtc = DateTime.UtcNow;
associatedUser.LastLoginDate = DateTime.UtcNow;
await _backOfficeUserManager.UpdateAsync(associatedUser);
return await SignInBackOfficeUser(associatedUser, request);
@@ -17,12 +17,6 @@ public class BackOfficeDefaultController : Controller
public BackOfficeDefaultController(IRuntime umbracoRuntime)
=> _umbracoRuntime = umbracoRuntime;
[Obsolete("Use the non obsoleted constructor instead. Scheduled to be removed in v17")]
public BackOfficeDefaultController()
: this(StaticServiceProvider.Instance.GetRequiredService<IRuntime>())
{
}
[HttpGet]
[AllowAnonymous]
public async Task<IActionResult> Index(CancellationToken cancellationToken)
@@ -43,41 +43,6 @@ public class ExecuteTemplateQueryController : TemplateQueryControllerBase
_publishedContentStatusFilteringService = publishedContentStatusFilteringService;
}
[Obsolete("Please use the non-obsolete constructor. Will be removed in V17.")]
public ExecuteTemplateQueryController(
IPublishedContentQuery publishedContentQuery,
IVariationContextAccessor variationContextAccessor,
IPublishedValueFallback publishedValueFallback,
IContentTypeService contentTypeService,
IPublishedContentCache contentCache,
IDocumentNavigationQueryService documentNavigationQueryService,
IPublishedContentStatusFilteringService publishedContentStatusFilteringService)
: this(
publishedContentQuery,
publishedValueFallback,
contentTypeService,
documentNavigationQueryService,
publishedContentStatusFilteringService)
{
}
[Obsolete("Please use the non-obsolete constructor. Will be removed in V17.")]
public ExecuteTemplateQueryController(
IPublishedContentQuery publishedContentQuery,
IVariationContextAccessor variationContextAccessor,
IPublishedValueFallback publishedValueFallback,
IContentTypeService contentTypeService,
IPublishedContentCache contentCache,
IDocumentNavigationQueryService documentNavigationQueryService)
: this(
publishedContentQuery,
publishedValueFallback,
contentTypeService,
documentNavigationQueryService,
StaticServiceProvider.Instance.GetRequiredService<IPublishedContentStatusFilteringService>())
{
}
[HttpPost("execute")]
[MapToApiVersion("1.0")]
[ProducesResponseType(typeof(TemplateQueryResultResponseModel), StatusCodes.Status200OK)]
@@ -11,13 +11,13 @@ internal static class AuditLogBuilderExtensions
internal static IUmbracoBuilder AddAuditLogs(this IUmbracoBuilder builder)
{
builder.Services.AddTransient<IAuditLogPresentationFactory, AuditLogPresentationFactory>();
builder.AddNotificationHandler<UserLoginSuccessNotification, BackOfficeUserManagerAuditer>();
builder.AddNotificationHandler<UserLogoutSuccessNotification, BackOfficeUserManagerAuditer>();
builder.AddNotificationHandler<UserLoginFailedNotification, BackOfficeUserManagerAuditer>();
builder.AddNotificationHandler<UserForgotPasswordRequestedNotification, BackOfficeUserManagerAuditer>();
builder.AddNotificationHandler<UserForgotPasswordChangedNotification, BackOfficeUserManagerAuditer>();
builder.AddNotificationHandler<UserPasswordChangedNotification, BackOfficeUserManagerAuditer>();
builder.AddNotificationHandler<UserPasswordResetNotification, BackOfficeUserManagerAuditer>();
builder.AddNotificationAsyncHandler<UserLoginSuccessNotification, BackOfficeUserManagerAuditer>();
builder.AddNotificationAsyncHandler<UserLogoutSuccessNotification, BackOfficeUserManagerAuditer>();
builder.AddNotificationAsyncHandler<UserLoginFailedNotification, BackOfficeUserManagerAuditer>();
builder.AddNotificationAsyncHandler<UserForgotPasswordRequestedNotification, BackOfficeUserManagerAuditer>();
builder.AddNotificationAsyncHandler<UserForgotPasswordChangedNotification, BackOfficeUserManagerAuditer>();
builder.AddNotificationAsyncHandler<UserPasswordChangedNotification, BackOfficeUserManagerAuditer>();
builder.AddNotificationAsyncHandler<UserPasswordResetNotification, BackOfficeUserManagerAuditer>();
return builder;
}
@@ -0,0 +1,15 @@
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Api.Management.Services.NewsDashboard;
using Umbraco.Cms.Core.DependencyInjection;
namespace Umbraco.Cms.Api.Management.DependencyInjection;
internal static class NewsDashboardBuilderExtensions
{
internal static IUmbracoBuilder AddNewsDashboard(this IUmbracoBuilder builder)
{
builder.Services.AddSingleton<INewsDashboardService, NewsDashboardService>();
return builder;
}
}
@@ -25,7 +25,7 @@ public static class InstallerBuilderExtensions
builder.AddInstallSteps();
services.AddTransient<IInstallService, InstallService>();
builder.AddNotificationAsyncHandler<UnattendedInstallNotification, CreateUnattendedUserNotificationHandler>();
builder.AddNotificationAsyncHandler<UnattendedInstallNotification, PostUnattendedInstallNotificationHandler>();
builder.WithCollectionBuilder<MapDefinitionCollectionBuilder>().Add<InstallerViewModelsMapDefinition>();
return builder;
@@ -30,7 +30,7 @@ public static partial class UmbracoBuilderExtensions
.AddMembersIdentity()
.AddUmbracoProfiler()
.AddMvcAndRazor(configureMvc)
.AddRecurringBackgroundJobs()
.AddBackgroundJobs()
.AddUmbracoHybridCache()
.AddDistributedCache()
.AddCoreNotifications();
@@ -71,7 +71,8 @@ public static partial class UmbracoBuilderExtensions
.AddUserData()
.AddSegment()
.AddExport()
.AddImport();
.AddImport()
.AddNewsDashboard();
services
.ConfigureOptions<ConfigureApiBehaviorOptions>()
@@ -14,15 +14,6 @@ public class DocumentCollectionPresentationFactory : ContentCollectionPresentati
private readonly IPublicAccessService _publicAccessService;
private readonly IEntityService _entityService;
[Obsolete("Please use the non-obsolete constructor. Scheduled for removal in V17.")]
public DocumentCollectionPresentationFactory(IUmbracoMapper mapper, IPublicAccessService publicAccessService)
: this(
mapper,
publicAccessService,
StaticServiceProvider.Instance.GetRequiredService<IEntityService>())
{
}
[ActivatorUtilitiesConstructor]
public DocumentCollectionPresentationFactory(IUmbracoMapper mapper, IPublicAccessService publicAccessService, IEntityService entityService)
: base(mapper)
@@ -65,22 +65,6 @@ internal sealed class DocumentPresentationFactory : IDocumentPresentationFactory
_flagProviderCollection = flagProviderCollection;
}
[Obsolete("Schedule for removal in v17")]
public async Task<DocumentResponseModel> CreateResponseModelAsync(IContent content)
{
DocumentResponseModel responseModel = _umbracoMapper.Map<DocumentResponseModel>(content)!;
Guid? templateKey = content.TemplateId.HasValue
? _templateService.GetAsync(content.TemplateId.Value).Result?.Key
: null;
responseModel.Template = templateKey.HasValue
? new ReferenceByIdModel { Id = templateKey.Value }
: null;
return responseModel;
}
public async Task<PublishedDocumentResponseModel> CreatePublishedResponseModelAsync(IContent content)
{
PublishedDocumentResponseModel responseModel = _umbracoMapper.Map<PublishedDocumentResponseModel>(content)!;
@@ -181,68 +165,6 @@ internal sealed class DocumentPresentationFactory : IDocumentPresentationFactory
public DocumentTypeReferenceResponseModel CreateDocumentTypeReferenceResponseModel(IDocumentEntitySlim entity)
=> _umbracoMapper.Map<DocumentTypeReferenceResponseModel>(entity)!;
[Obsolete("Use CreateCulturePublishScheduleModels instead. Scheduled for removal in v17")]
public Attempt<CultureAndScheduleModel, ContentPublishingOperationStatus> CreateCultureAndScheduleModel(PublishDocumentRequestModel requestModel)
{
var contentScheduleCollection = new ContentScheduleCollection();
var culturesToPublishImmediately = new HashSet<string>();
foreach (CultureAndScheduleRequestModel cultureAndScheduleRequestModel in requestModel.PublishSchedules)
{
if (cultureAndScheduleRequestModel.Schedule is null || (cultureAndScheduleRequestModel.Schedule.PublishTime is null && cultureAndScheduleRequestModel.Schedule.UnpublishTime is null))
{
culturesToPublishImmediately.Add(cultureAndScheduleRequestModel.Culture ?? Constants.System.InvariantCulture); // API have `null` for invariant, but service layer has "*".
continue;
}
if (cultureAndScheduleRequestModel.Schedule.PublishTime is not null)
{
if (cultureAndScheduleRequestModel.Schedule.PublishTime <= _timeProvider.GetUtcNow())
{
return Attempt.FailWithStatus(ContentPublishingOperationStatus.PublishTimeNeedsToBeInFuture, new CultureAndScheduleModel()
{
Schedules = contentScheduleCollection,
CulturesToPublishImmediately = culturesToPublishImmediately,
});
}
contentScheduleCollection.Add(new ContentSchedule(
cultureAndScheduleRequestModel.Culture ?? Constants.System.InvariantCulture,
cultureAndScheduleRequestModel.Schedule.PublishTime.Value.UtcDateTime,
ContentScheduleAction.Release));
}
if (cultureAndScheduleRequestModel.Schedule.UnpublishTime is not null)
{
if (cultureAndScheduleRequestModel.Schedule.UnpublishTime <= cultureAndScheduleRequestModel.Schedule.PublishTime)
{
return Attempt.FailWithStatus(ContentPublishingOperationStatus.UnpublishTimeNeedsToBeAfterPublishTime, new CultureAndScheduleModel()
{
Schedules = contentScheduleCollection,
CulturesToPublishImmediately = culturesToPublishImmediately,
});
}
if (cultureAndScheduleRequestModel.Schedule.UnpublishTime <= _timeProvider.GetUtcNow())
{
return Attempt.FailWithStatus(ContentPublishingOperationStatus.UpublishTimeNeedsToBeInFuture, new CultureAndScheduleModel()
{
Schedules = contentScheduleCollection,
CulturesToPublishImmediately = culturesToPublishImmediately,
});
}
contentScheduleCollection.Add(new ContentSchedule(
cultureAndScheduleRequestModel.Culture ?? Constants.System.InvariantCulture,
cultureAndScheduleRequestModel.Schedule.UnpublishTime.Value.UtcDateTime,
ContentScheduleAction.Expire));
}
}
return Attempt.SucceedWithStatus(ContentPublishingOperationStatus.Success, new CultureAndScheduleModel()
{
Schedules = contentScheduleCollection,
CulturesToPublishImmediately = culturesToPublishImmediately,
});
}
public Attempt<List<CulturePublishScheduleModel>, ContentPublishingOperationStatus> CreateCulturePublishScheduleModels(PublishDocumentRequestModel requestModel)
{
var model = new List<CulturePublishScheduleModel>();
@@ -1,24 +1,42 @@
using Microsoft.Extensions.Logging;
using Umbraco.Cms.Api.Management.Routing;
using Umbraco.Cms.Api.Management.ViewModels.Document;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.Membership;
using Umbraco.Cms.Core.Routing;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
using Umbraco.Extensions;
namespace Umbraco.Cms.Api.Management.Factories;
public class DocumentUrlFactory : IDocumentUrlFactory
{
private readonly IPublishedUrlInfoProvider _publishedUrlInfoProvider;
private readonly UrlProviderCollection _urlProviders;
private readonly IPreviewService _previewService;
private readonly IBackOfficeSecurityAccessor _backOfficeSecurityAccessor;
private readonly ILogger<DocumentUrlFactory> _logger;
public DocumentUrlFactory(IPublishedUrlInfoProvider publishedUrlInfoProvider)
=> _publishedUrlInfoProvider = publishedUrlInfoProvider;
public DocumentUrlFactory(
IPublishedUrlInfoProvider publishedUrlInfoProvider,
UrlProviderCollection urlProviders,
IPreviewService previewService,
IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
ILogger<DocumentUrlFactory> logger)
{
_publishedUrlInfoProvider = publishedUrlInfoProvider;
_urlProviders = urlProviders;
_previewService = previewService;
_backOfficeSecurityAccessor = backOfficeSecurityAccessor;
_logger = logger;
}
public async Task<IEnumerable<DocumentUrlInfo>> CreateUrlsAsync(IContent content)
{
ISet<UrlInfo> urlInfos = await _publishedUrlInfoProvider.GetAllAsync(content);
return urlInfos
.Where(urlInfo => urlInfo.IsUrl)
.Select(urlInfo => new DocumentUrlInfo { Culture = urlInfo.Culture, Url = urlInfo.Text })
.Select(CreateDocumentUrlInfo)
.ToArray();
}
@@ -34,4 +52,52 @@ public class DocumentUrlFactory : IDocumentUrlFactory
return documentUrlInfoResourceSets;
}
public async Task<DocumentUrlInfo?> GetPreviewUrlAsync(IContent content, string providerAlias, string? culture, string? segment)
{
IUrlProvider? provider = _urlProviders.FirstOrDefault(provider => provider.Alias.InvariantEquals(providerAlias));
if (provider is null)
{
_logger.LogError("Could not resolve a URL provider requested for preview - it was not registered in the URL providers collection.");
return null;
}
UrlInfo? previewUrlInfo = await provider.GetPreviewUrlAsync(content, culture, segment);
if (previewUrlInfo is null)
{
_logger.LogError("The URL provider could not generate a preview URL for content with key: {contentKey}", content.Key);
return null;
}
// must initiate preview state for internal preview URLs
if (previewUrlInfo.Url is not null && previewUrlInfo.IsExternal is false)
{
IUser? currentUser = _backOfficeSecurityAccessor.BackOfficeSecurity?.CurrentUser;
if (currentUser is null)
{
_logger.LogError("Could not access the current backoffice user while attempting to authenticate for preview.");
return null;
}
if (await _previewService.TryEnterPreviewAsync(currentUser) is false)
{
_logger.LogError("A server error occured, could not initiate an authenticated preview state for the current user.");
return null;
}
}
return CreateDocumentUrlInfo(previewUrlInfo);
}
private DocumentUrlInfo CreateDocumentUrlInfo(UrlInfo urlInfo)
{
var url = urlInfo.Url?.ToString();
return new DocumentUrlInfo
{
Culture = urlInfo.Culture,
Url = url,
Message = urlInfo.Message,
Provider = urlInfo.Provider,
};
}
}
@@ -41,14 +41,6 @@ public class HealthCheckGroupPresentationFactory : IHealthCheckGroupPresentation
return groups;
}
[Obsolete("Use CreateHealthCheckGroupWithResultViewModelAsync instead. Will be removed in v17.")]
public HealthCheckGroupWithResultResponseModel CreateHealthCheckGroupWithResultViewModel(IGrouping<string?, HealthCheck> healthCheckGroup)
=> CreateHealthCheckGroupWithResultViewModelAsync(healthCheckGroup).GetAwaiter().GetResult();
[Obsolete("Use CreateHealthCheckGroupWithResultViewModelAsync instead. Will be removed in v17.")]
public HealthCheckWithResultPresentationModel CreateHealthCheckWithResultViewModel(HealthCheck healthCheck) =>
CreateHealthCheckWithResultViewModelAsync(healthCheck).GetAwaiter().GetResult();
public async Task<HealthCheckGroupWithResultResponseModel> CreateHealthCheckGroupWithResultViewModelAsync(IGrouping<string?, HealthCheck> healthCheckGroup)
{
var healthChecks = new List<HealthCheckWithResultPresentationModel>();
@@ -14,17 +14,9 @@ namespace Umbraco.Cms.Api.Management.Factories;
public interface IDocumentPresentationFactory
{
[Obsolete("Schedule for removal in v17")]
Task<DocumentResponseModel> CreateResponseModelAsync(IContent content);
Task<PublishedDocumentResponseModel> CreatePublishedResponseModelAsync(IContent content);
Task<DocumentResponseModel> CreateResponseModelAsync(IContent content, ContentScheduleCollection schedule)
#pragma warning disable CS0618 // Type or member is obsolete
// Remove when obsolete CreateResponseModelAsync is removed
=> CreateResponseModelAsync(content);
#pragma warning restore CS0618 // Type or member is obsolete
Task<DocumentResponseModel> CreateResponseModelAsync(IContent content, ContentScheduleCollection schedule);
DocumentItemResponseModel CreateItemResponseModel(IDocumentEntitySlim entity);
DocumentBlueprintItemResponseModel CreateBlueprintItemResponseModel(IDocumentEntitySlim entity);
@@ -33,9 +25,6 @@ public interface IDocumentPresentationFactory
DocumentTypeReferenceResponseModel CreateDocumentTypeReferenceResponseModel(IDocumentEntitySlim entity);
[Obsolete("Use CreateCulturePublishScheduleModels instead. Scheduled for removal in v17")]
Attempt<CultureAndScheduleModel, ContentPublishingOperationStatus> CreateCultureAndScheduleModel(PublishDocumentRequestModel requestModel);
Attempt<List<CulturePublishScheduleModel>, ContentPublishingOperationStatus> CreateCulturePublishScheduleModels(
PublishDocumentRequestModel requestModel)
{
@@ -8,4 +8,6 @@ public interface IDocumentUrlFactory
Task<IEnumerable<DocumentUrlInfo>> CreateUrlsAsync(IContent content);
Task<IEnumerable<DocumentUrlInfoResponseModel>> CreateUrlSetsAsync(IEnumerable<IContent> contentItems);
Task<DocumentUrlInfo?> GetPreviewUrlAsync(IContent content, string providerAlias, string? culture, string? segment);
}
@@ -7,19 +7,8 @@ public interface IHealthCheckGroupPresentationFactory
{
IEnumerable<IGrouping<string?, HealthCheck>> CreateGroupingFromHealthCheckCollection();
[Obsolete("Use CreateHealthCheckGroupWithResultViewModelAsync instead. Will be removed in v17.")]
HealthCheckGroupWithResultResponseModel CreateHealthCheckGroupWithResultViewModel(IGrouping<string?, HealthCheck> healthCheckGroup);
Task<HealthCheckGroupWithResultResponseModel> CreateHealthCheckGroupWithResultViewModelAsync(
IGrouping<string?, HealthCheck> healthCheckGroup);
[Obsolete("Use CreateHealthCheckGroupWithResultViewModelAsync instead. Will be removed in v17.")]
HealthCheckWithResultPresentationModel CreateHealthCheckWithResultViewModel(HealthCheck healthCheck);
Task<HealthCheckGroupWithResultResponseModel> CreateHealthCheckGroupWithResultViewModelAsync(IGrouping<string?, HealthCheck> healthCheckGroup)
#pragma warning disable CS0618 // Type or member is obsolete
=> Task.FromResult(CreateHealthCheckGroupWithResultViewModel(healthCheckGroup));
#pragma warning restore CS0618 // Type or member is obsolete
Task<HealthCheckWithResultPresentationModel> CreateHealthCheckWithResultViewModelAsync(HealthCheck healthCheck)
#pragma warning disable CS0618 // Type or member is obsolete
=> Task.FromResult(CreateHealthCheckWithResultViewModel(healthCheck));
#pragma warning restore CS0618 // Type or member is obsolete
Task<HealthCheckWithResultPresentationModel> CreateHealthCheckWithResultViewModelAsync(HealthCheck healthCheck);
}
@@ -5,5 +5,8 @@ namespace Umbraco.Cms.Api.Management.Factories;
public interface IIndexPresentationFactory
{
[Obsolete("Use CreateAsync() instead. Scheduled for removal in v19.")]
IndexResponseModel Create(IIndex index);
Task<IndexResponseModel> CreateAsync(IIndex index) => Task.FromResult(Create(index));
}
@@ -28,21 +28,17 @@ public class IndexPresentationFactory : IIndexPresentationFactory
_logger = logger;
}
[Obsolete("Use the non obsolete method instead. Scheduled for removal in v17")]
public IndexPresentationFactory(IIndexDiagnosticsFactory indexDiagnosticsFactory, IIndexRebuilder indexRebuilder, IIndexingRebuilderService indexingRebuilderService)
:this(
indexDiagnosticsFactory,
indexRebuilder,
indexingRebuilderService,
StaticServiceProvider.Instance.GetRequiredService<ILogger<IndexPresentationFactory>>())
{
}
/// <inheritdoc />
[Obsolete("Use CreateAsync() instead. Scheduled for removal in v19.")]
public IndexResponseModel Create(IIndex index)
=> CreateAsync(index).GetAwaiter().GetResult();
/// <inheritdoc />
public async Task<IndexResponseModel> CreateAsync(IIndex index)
{
var isCorrupt = !TryGetSearcherName(index, out var searcherName);
if (_indexingRebuilderService.IsRebuilding(index.Name))
if (await _indexingRebuilderService.IsRebuildingAsync(index.Name))
{
return new IndexResponseModel
{
@@ -63,7 +59,7 @@ public class IndexPresentationFactory : IIndexPresentationFactory
var properties = new Dictionary<string, object?>();
foreach (var property in indexDiag.Metadata)
foreach (KeyValuePair<string, object?> property in indexDiag.Metadata)
{
if (property.Value is null)
{
@@ -71,7 +67,7 @@ public class IndexPresentationFactory : IIndexPresentationFactory
}
else
{
var propertyType = property.Value.GetType();
Type propertyType = property.Value.GetType();
properties[property.Key] = propertyType.IsClass && !propertyType.IsArray ? property.Value?.ToString() : property.Value;
}
}
@@ -29,7 +29,7 @@ public class ModelsBuilderPresentationFactory : IModelsBuilderPresentationFactor
new()
{
Mode = _modelsBuilderSettings.ModelsMode,
CanGenerate = _modelsBuilderSettings.ModelsMode.SupportsExplicitGeneration(),
CanGenerate = _modelsBuilderSettings.ModelsMode is Constants.ModelsBuilder.ModelsModes.SourceCodeManual or Constants.ModelsBuilder.ModelsModes.SourceCodeAuto,
OutOfDateModels = _outOfDateModels.IsOutOfDate,
LastError = _mbErrors.GetLastError(),
Version = ApiVersion.Current.Version.ToString(),
@@ -18,16 +18,6 @@ public class RelationTypePresentationFactory : IRelationTypePresentationFactory
private readonly IDocumentPresentationFactory _documentPresentationFactory;
private readonly IScopeProvider _scopeProvider;
[Obsolete("Please use the non obsoleted constructor. Scheduled for removal in v17")]
public RelationTypePresentationFactory(IUmbracoMapper umbracoMapper)
: this(
umbracoMapper,
StaticServiceProvider.Instance.GetRequiredService<IEntityRepository>(),
StaticServiceProvider.Instance.GetRequiredService<IDocumentPresentationFactory>(),
StaticServiceProvider.Instance.GetRequiredService<IScopeProvider>())
{
}
public RelationTypePresentationFactory(
IUmbracoMapper umbracoMapper,
IEntityRepository entityRepository,
@@ -43,39 +43,6 @@ public class UserPresentationFactory : IUserPresentationFactory
/// <summary>
/// Initializes a new instance of the <see cref="UserPresentationFactory"/> class.
/// </summary>
[Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 17.")]
public UserPresentationFactory(
IEntityService entityService,
AppCaches appCaches,
MediaFileManager mediaFileManager,
IImageUrlGenerator imageUrlGenerator,
IUserGroupPresentationFactory userGroupPresentationFactory,
IAbsoluteUrlBuilder absoluteUrlBuilder,
IEmailSender emailSender,
IPasswordConfigurationPresentationFactory passwordConfigurationPresentationFactory,
IOptionsSnapshot<SecuritySettings> securitySettings,
IBackOfficeExternalLoginProviders externalLoginProviders)
: this(
entityService,
appCaches,
mediaFileManager,
imageUrlGenerator,
userGroupPresentationFactory,
absoluteUrlBuilder,
emailSender,
passwordConfigurationPresentationFactory,
securitySettings,
externalLoginProviders,
StaticServiceProvider.Instance.GetRequiredService<IUserService>(),
StaticServiceProvider.Instance.GetRequiredService<IContentService>(),
StaticServiceProvider.Instance.GetRequiredService<IEnumerable<IPermissionPresentationMapper>>())
{
}
/// <summary>
/// Initializes a new instance of the <see cref="UserPresentationFactory"/> class.
/// </summary>
[Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 17.")]
public UserPresentationFactory(
IEntityService entityService,
AppCaches appCaches,
@@ -87,45 +54,6 @@ public class UserPresentationFactory : IUserPresentationFactory
IPasswordConfigurationPresentationFactory passwordConfigurationPresentationFactory,
IOptionsSnapshot<SecuritySettings> securitySettings,
IBackOfficeExternalLoginProviders externalLoginProviders,
IUserService userService,
IContentService contentService)
: this(
entityService,
appCaches,
mediaFileManager,
imageUrlGenerator,
userGroupPresentationFactory,
absoluteUrlBuilder,
emailSender,
passwordConfigurationPresentationFactory,
securitySettings,
externalLoginProviders,
userService,
contentService,
StaticServiceProvider.Instance.GetRequiredService<IEnumerable<IPermissionPresentationMapper>>())
{
}
// TODO (V17): Remove the unused userService and contentService parameters from this constructor.
/// <summary>
/// Initializes a new instance of the <see cref="UserPresentationFactory"/> class.
/// </summary>
public UserPresentationFactory(
IEntityService entityService,
AppCaches appCaches,
MediaFileManager mediaFileManager,
IImageUrlGenerator imageUrlGenerator,
IUserGroupPresentationFactory userGroupPresentationFactory,
IAbsoluteUrlBuilder absoluteUrlBuilder,
IEmailSender emailSender,
IPasswordConfigurationPresentationFactory passwordConfigurationPresentationFactory,
IOptionsSnapshot<SecuritySettings> securitySettings,
IBackOfficeExternalLoginProviders externalLoginProviders,
#pragma warning disable IDE0060 // Remove unused parameter - need to keep these until the next major to avoid breaking changes and/or ambiguous constructor errors
IUserService userService,
IContentService contentService,
#pragma warning restore IDE0060 // Remove unused parameter
IEnumerable<IPermissionPresentationMapper> permissionPresentationMappers)
{
_entityService = entityService;
@@ -12,27 +12,31 @@ using Umbraco.Extensions;
namespace Umbraco.Cms.Api.Management.Install;
public class CreateUnattendedUserNotificationHandler : INotificationAsyncHandler<UnattendedInstallNotification>
public class PostUnattendedInstallNotificationHandler : INotificationAsyncHandler<UnattendedInstallNotification>
{
private readonly IServiceScopeFactory _serviceScopeFactory;
private readonly IOptions<UnattendedSettings> _unattendedSettings;
private readonly IUserService _userService;
private readonly IMetricsConsentService _metricsConsentService;
public CreateUnattendedUserNotificationHandler(IOptions<UnattendedSettings> unattendedSettings, IUserService userService, IServiceScopeFactory serviceScopeFactory)
public PostUnattendedInstallNotificationHandler(IOptions<UnattendedSettings> unattendedSettings, IUserService userService, IServiceScopeFactory serviceScopeFactory, IMetricsConsentService metricsConsentService)
{
_unattendedSettings = unattendedSettings;
_userService = userService;
_serviceScopeFactory = serviceScopeFactory;
_metricsConsentService = metricsConsentService;
}
/// <summary>
/// Listening for when the UnattendedInstallNotification fired after a sucessfulk
/// Listening for when the UnattendedInstallNotification fired after a successful unattended install
/// This creates the user and sets the telemetry level based on the 'Unattended' settings.
/// </summary>
/// <param name="notification"></param>
/// <param name="cancellationToken"></param>
public async Task HandleAsync(UnattendedInstallNotification notification, CancellationToken cancellationToken)
{
UnattendedSettings? unattendedSettings = _unattendedSettings.Value;
// Ensure we have the setting enabled (Sanity check)
// In theory this should always be true as the event only fired when a sucessfull
if (_unattendedSettings.Value.InstallUnattended == false)
@@ -83,7 +87,7 @@ public class CreateUnattendedUserNotificationHandler : INotificationAsyncHandler
$"No user found in membership provider with id of {Constants.Security.SuperUserIdAsString}.");
}
//To change the password here we actually need to reset it since we don't have an old one to use to change
// To change the password here we actually need to reset it since we don't have an old one to use to change
var resetToken = await backOfficeUserManager.GeneratePasswordResetTokenAsync(membershipUser);
if (string.IsNullOrWhiteSpace(resetToken))
{
@@ -98,5 +102,7 @@ public class CreateUnattendedUserNotificationHandler : INotificationAsyncHandler
throw new InvalidOperationException("Could not reset password: " +
string.Join(", ", resetResult.Errors.ToErrorMessage()));
}
await _metricsConsentService.SetConsentLevelAsync(unattendedSettings.UnattendedTelemetryLevel);
}
}
@@ -22,17 +22,6 @@ public class DocumentPermissionMapper : IPermissionPresentationMapper, IPermissi
private readonly Lazy<IEntityService> _entityService;
private readonly Lazy<IUserService> _userService;
/// <summary>
/// Initializes a new instance of the <see cref="DocumentPermissionMapper"/> class.
/// </summary>
[Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 17.")]
public DocumentPermissionMapper()
: this(
StaticServiceProvider.Instance.GetRequiredService<Lazy<IEntityService>>(),
StaticServiceProvider.Instance.GetRequiredService<Lazy<IUserService>>())
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DocumentPermissionMapper"/> class.
/// </summary>
@@ -21,18 +21,6 @@ public class BackOfficeAuthorizationInitializationMiddleware : IMiddleware
private readonly IRuntimeState _runtimeState;
private readonly WebRoutingSettings _webRoutingSettings;
[Obsolete("Use the non-obsolete constructor. This will be removed in Umbraco 17.")]
public BackOfficeAuthorizationInitializationMiddleware(
UmbracoRequestPaths umbracoRequestPaths,
IServiceProvider serviceProvider,
IRuntimeState runtimeState,
IOptions<GlobalSettings> globalSettings,
IOptions<WebRoutingSettings> webRoutingSettings,
IHostingEnvironment hostingEnvironment)
: this(umbracoRequestPaths, serviceProvider, runtimeState, webRoutingSettings)
{
}
public BackOfficeAuthorizationInitializationMiddleware(
UmbracoRequestPaths umbracoRequestPaths,
IServiceProvider serviceProvider,
+651 -182
View File
@@ -880,70 +880,6 @@
]
}
},
"/umbraco/management/api/v1/data-type/{id}/references": {
"get": {
"tags": [
"Data Type"
],
"operationId": "GetDataTypeByIdReferences",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/DataTypeReferenceResponseModel"
}
]
}
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ProblemDetails"
}
]
}
}
}
},
"401": {
"description": "The resource is protected and requires an authentication token"
},
"403": {
"description": "The authenticated user does not have access to this resource"
}
},
"deprecated": true,
"security": [
{
"Backoffice-User": [ ]
}
]
}
},
"/umbraco/management/api/v1/data-type/configuration": {
"get": {
"tags": [
@@ -8723,6 +8659,101 @@
]
}
},
"/umbraco/management/api/v1/document/{id}/preview-url": {
"get": {
"tags": [
"Document"
],
"operationId": "GetDocumentByIdPreviewUrl",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "providerAlias",
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "culture",
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "segment",
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/DocumentUrlInfoModel"
}
]
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ProblemDetails"
}
]
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ProblemDetails"
}
]
}
}
}
},
"401": {
"description": "The resource is protected and requires an authentication token"
},
"403": {
"description": "The authenticated user does not have access to this resource"
}
},
"security": [
{
"Backoffice-User": [ ]
}
]
}
},
"/umbraco/management/api/v1/document/{id}/public-access": {
"post": {
"tags": [
@@ -20290,6 +20321,461 @@
]
}
},
"/umbraco/management/api/v1/member-type/folder": {
"post": {
"tags": [
"Member Type"
],
"operationId": "PostMemberTypeFolder",
"requestBody": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/CreateFolderRequestModel"
}
]
}
},
"text/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/CreateFolderRequestModel"
}
]
}
},
"application/*+json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/CreateFolderRequestModel"
}
]
}
}
}
},
"responses": {
"201": {
"description": "Created",
"headers": {
"Umb-Generated-Resource": {
"description": "Identifier of the newly created resource",
"schema": {
"type": "string",
"description": "Identifier of the newly created resource"
}
},
"Location": {
"description": "Location of the newly created resource",
"schema": {
"type": "string",
"description": "Location of the newly created resource",
"format": "uri"
}
},
"Umb-Notifications": {
"description": "The list of notifications produced during the request.",
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NotificationHeaderModel"
},
"nullable": true
}
}
}
},
"400": {
"description": "Bad Request",
"headers": {
"Umb-Notifications": {
"description": "The list of notifications produced during the request.",
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NotificationHeaderModel"
},
"nullable": true
}
}
},
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ProblemDetails"
}
]
}
}
}
},
"404": {
"description": "Not Found",
"headers": {
"Umb-Notifications": {
"description": "The list of notifications produced during the request.",
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NotificationHeaderModel"
},
"nullable": true
}
}
},
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ProblemDetails"
}
]
}
}
}
},
"401": {
"description": "The resource is protected and requires an authentication token"
},
"403": {
"description": "The authenticated user does not have access to this resource",
"headers": {
"Umb-Notifications": {
"description": "The list of notifications produced during the request.",
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NotificationHeaderModel"
},
"nullable": true
}
}
}
}
},
"security": [
{
"Backoffice-User": [ ]
}
]
}
},
"/umbraco/management/api/v1/member-type/folder/{id}": {
"get": {
"tags": [
"Member Type"
],
"operationId": "GetMemberTypeFolderById",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/FolderResponseModel"
}
]
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ProblemDetails"
}
]
}
}
}
},
"401": {
"description": "The resource is protected and requires an authentication token"
},
"403": {
"description": "The authenticated user does not have access to this resource"
}
},
"security": [
{
"Backoffice-User": [ ]
}
]
},
"delete": {
"tags": [
"Member Type"
],
"operationId": "DeleteMemberTypeFolderById",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {
"Umb-Notifications": {
"description": "The list of notifications produced during the request.",
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NotificationHeaderModel"
},
"nullable": true
}
}
}
},
"400": {
"description": "Bad Request",
"headers": {
"Umb-Notifications": {
"description": "The list of notifications produced during the request.",
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NotificationHeaderModel"
},
"nullable": true
}
}
},
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ProblemDetails"
}
]
}
}
}
},
"404": {
"description": "Not Found",
"headers": {
"Umb-Notifications": {
"description": "The list of notifications produced during the request.",
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NotificationHeaderModel"
},
"nullable": true
}
}
},
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ProblemDetails"
}
]
}
}
}
},
"401": {
"description": "The resource is protected and requires an authentication token"
},
"403": {
"description": "The authenticated user does not have access to this resource",
"headers": {
"Umb-Notifications": {
"description": "The list of notifications produced during the request.",
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NotificationHeaderModel"
},
"nullable": true
}
}
}
}
},
"security": [
{
"Backoffice-User": [ ]
}
]
},
"put": {
"tags": [
"Member Type"
],
"operationId": "PutMemberTypeFolderById",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/UpdateFolderResponseModel"
}
]
}
},
"text/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/UpdateFolderResponseModel"
}
]
}
},
"application/*+json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/UpdateFolderResponseModel"
}
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"headers": {
"Umb-Notifications": {
"description": "The list of notifications produced during the request.",
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NotificationHeaderModel"
},
"nullable": true
}
}
}
},
"400": {
"description": "Bad Request",
"headers": {
"Umb-Notifications": {
"description": "The list of notifications produced during the request.",
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NotificationHeaderModel"
},
"nullable": true
}
}
},
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ProblemDetails"
}
]
}
}
}
},
"404": {
"description": "Not Found",
"headers": {
"Umb-Notifications": {
"description": "The list of notifications produced during the request.",
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NotificationHeaderModel"
},
"nullable": true
}
}
},
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ProblemDetails"
}
]
}
}
}
},
"401": {
"description": "The resource is protected and requires an authentication token"
},
"403": {
"description": "The authenticated user does not have access to this resource",
"headers": {
"Umb-Notifications": {
"description": "The list of notifications produced during the request.",
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NotificationHeaderModel"
},
"nullable": true
}
}
}
}
},
"security": [
{
"Backoffice-User": [ ]
}
]
}
},
"/umbraco/management/api/v1/tree/member-type/root": {
"get": {
"tags": [
@@ -21747,6 +22233,38 @@
]
}
},
"/umbraco/management/api/v1/news-dashboard": {
"get": {
"tags": [
"News Dashboard"
],
"operationId": "GetNewsDashboard",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/NewsDashboardResponseModel"
}
]
}
}
}
},
"401": {
"description": "The resource is protected and requires an authentication token"
}
},
"security": [
{
"Backoffice-User": [ ]
}
]
}
},
"/umbraco/management/api/v1/object-types": {
"get": {
"tags": [
@@ -23933,6 +24451,7 @@
"description": "The resource is protected and requires an authentication token"
}
},
"deprecated": true,
"security": [
{
"Backoffice-User": [ ]
@@ -37641,34 +38160,6 @@
],
"type": "string"
},
"DataTypeContentTypeReferenceModel": {
"required": [
"icon",
"id",
"name",
"type"
],
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"type": {
"type": "string",
"nullable": true
},
"name": {
"type": "string",
"nullable": true
},
"icon": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"DataTypeItemResponseModel": {
"required": [
"editorAlias",
@@ -37724,49 +38215,6 @@
},
"additionalProperties": false
},
"DataTypePropertyReferenceModel": {
"required": [
"alias",
"name"
],
"type": "object",
"properties": {
"name": {
"type": "string"
},
"alias": {
"type": "string"
}
},
"additionalProperties": false
},
"DataTypeReferenceResponseModel": {
"required": [
"contentType",
"properties"
],
"type": "object",
"properties": {
"contentType": {
"oneOf": [
{
"$ref": "#/components/schemas/DataTypeContentTypeReferenceModel"
}
]
},
"properties": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/DataTypePropertyReferenceModel"
}
]
}
}
},
"additionalProperties": false
},
"DataTypeResponseModel": {
"required": [
"canIgnoreStartNodes",
@@ -38720,7 +39168,6 @@
"flags",
"id",
"isTrashed",
"urls",
"values",
"variants"
],
@@ -38767,17 +39214,6 @@
}
]
},
"urls": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/DocumentUrlInfoModel"
}
]
},
"deprecated": true
},
"template": {
"oneOf": [
{
@@ -39499,6 +39935,8 @@
"DocumentUrlInfoModel": {
"required": [
"culture",
"message",
"provider",
"url"
],
"type": "object",
@@ -39508,6 +39946,14 @@
"nullable": true
},
"url": {
"type": "string",
"nullable": true
},
"message": {
"type": "string",
"nullable": true
},
"provider": {
"type": "string"
}
},
@@ -41074,7 +41520,6 @@
"id",
"isTrashed",
"mediaType",
"urls",
"values",
"variants"
],
@@ -41114,17 +41559,6 @@
]
}
},
"urls": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/MediaUrlInfoModel"
}
]
},
"deprecated": true
},
"isTrashed": {
"type": "boolean"
},
@@ -41716,7 +42150,8 @@
"nullable": true
},
"url": {
"type": "string"
"type": "string",
"nullable": true
}
},
"additionalProperties": false
@@ -42658,7 +43093,7 @@
"type": "object",
"properties": {
"mode": {
"$ref": "#/components/schemas/ModelsModeModel"
"type": "string"
},
"canGenerate": {
"type": "boolean"
@@ -42684,15 +43119,6 @@
},
"additionalProperties": false
},
"ModelsModeModel": {
"enum": [
"Nothing",
"InMemoryAuto",
"SourceCodeManual",
"SourceCodeAuto"
],
"type": "string"
},
"MoveDataTypeRequestModel": {
"type": "object",
"properties": {
@@ -42831,6 +43257,61 @@
},
"additionalProperties": false
},
"NewsDashboardItemResponseModel": {
"required": [
"header",
"priority"
],
"type": "object",
"properties": {
"priority": {
"type": "string"
},
"header": {
"type": "string"
},
"body": {
"type": "string",
"nullable": true
},
"buttonText": {
"type": "string",
"nullable": true
},
"imageUrl": {
"type": "string",
"nullable": true
},
"imageAltText": {
"type": "string",
"nullable": true
},
"url": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"NewsDashboardResponseModel": {
"required": [
"items"
],
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/NewsDashboardItemResponseModel"
}
]
}
}
},
"additionalProperties": false
},
"NoopSetupTwoFactorModel": {
"type": "object",
"additionalProperties": false
@@ -44889,7 +45370,6 @@
"flags",
"id",
"isTrashed",
"urls",
"values",
"variants"
],
@@ -44936,17 +45416,6 @@
}
]
},
"urls": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/DocumentUrlInfoModel"
}
]
},
"deprecated": true
},
"template": {
"oneOf": [
{
@@ -32,10 +32,6 @@ public class BackOfficeApplicationManager : OpenIdDictApplicationManagerBase, IB
_authorizeCallbackLogoutPathName = securitySettings.Value.AuthorizeCallbackLogoutPathName;
}
[Obsolete("Please use the overload that allows for multiple back-office hosts. Will be removed in V17.")]
public async Task EnsureBackOfficeApplicationAsync(Uri backOfficeUrl, CancellationToken cancellationToken = default)
=> await EnsureBackOfficeApplicationAsync([backOfficeUrl], cancellationToken);
public async Task EnsureBackOfficeApplicationAsync(IEnumerable<Uri> backOfficeHosts, CancellationToken cancellationToken = default)
{
// Install is okay without this, because we do not need a token to install,
@@ -100,8 +96,7 @@ public class BackOfficeApplicationManager : OpenIdDictApplicationManagerBase, IB
public async Task DeleteBackOfficeClientCredentialsApplicationAsync(string clientId, CancellationToken cancellationToken = default)
=> await Delete(clientId, cancellationToken);
[Obsolete("Do not use - for internal usage only. Will be made internal in V17.")]
public OpenIddictApplicationDescriptor BackofficeOpenIddictApplicationDescriptor(Uri backOfficeUrl)
internal OpenIddictApplicationDescriptor BackofficeOpenIddictApplicationDescriptor(Uri backOfficeUrl)
=> BackofficeOpenIddictApplicationDescriptor([backOfficeUrl]);
internal OpenIddictApplicationDescriptor BackofficeOpenIddictApplicationDescriptor(Uri[] backOfficeHosts)
@@ -18,19 +18,6 @@ public class BackOfficeExternalLoginProviders : IBackOfficeExternalLoginProvider
private const string ExternalLoginProvidersKey = "Umbraco.Cms.Web.BackOffice.Security.BackOfficeExternalLoginProviders";
[Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 17.")]
public BackOfficeExternalLoginProviders(
IEnumerable<BackOfficeExternalLoginProvider> externalLogins,
IAuthenticationSchemeProvider authenticationSchemeProvider)
: this(
externalLogins,
authenticationSchemeProvider,
StaticServiceProvider.Instance.GetRequiredService<IKeyValueService>(),
StaticServiceProvider.Instance.GetRequiredService<IExternalLoginWithKeyService>(),
StaticServiceProvider.Instance.GetRequiredService<ILogger<BackOfficeExternalLoginProviders>>())
{
}
public BackOfficeExternalLoginProviders(
IEnumerable<BackOfficeExternalLoginProvider> externalLogins,
IAuthenticationSchemeProvider authenticationSchemeProvider,
@@ -1,4 +1,4 @@
using System.Globalization;
using System.Globalization;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models.Membership;
using Umbraco.Cms.Core.Notifications;
@@ -12,24 +12,32 @@ namespace Umbraco.Cms.Api.Management.Security;
/// Binds to notifications to write audit logs for the <see cref="BackOfficeUserManager" />
/// </summary>
internal sealed class BackOfficeUserManagerAuditer :
INotificationHandler<UserLoginSuccessNotification>,
INotificationHandler<UserLogoutSuccessNotification>,
INotificationHandler<UserLoginFailedNotification>,
INotificationHandler<UserForgotPasswordRequestedNotification>,
INotificationHandler<UserForgotPasswordChangedNotification>,
INotificationHandler<UserPasswordChangedNotification>,
INotificationHandler<UserPasswordResetNotification>
INotificationAsyncHandler<UserLoginSuccessNotification>,
INotificationAsyncHandler<UserLogoutSuccessNotification>,
INotificationAsyncHandler<UserLoginFailedNotification>,
INotificationAsyncHandler<UserForgotPasswordRequestedNotification>,
INotificationAsyncHandler<UserForgotPasswordChangedNotification>,
INotificationAsyncHandler<UserPasswordChangedNotification>,
INotificationAsyncHandler<UserPasswordResetNotification>
{
private readonly IAuditService _auditService;
private readonly IAuditEntryService _auditEntryService;
private readonly IUserService _userService;
public BackOfficeUserManagerAuditer(IAuditService auditService, IUserService userService)
/// <summary>
/// Initializes a new instance of the <see cref="BackOfficeUserManagerAuditer"/> class.
/// </summary>
/// <param name="auditEntryService">The audit entry service.</param>
/// <param name="userService">The user service.</param>
public BackOfficeUserManagerAuditer(
IAuditEntryService auditEntryService,
IUserService userService)
{
_auditService = auditService;
_auditEntryService = auditEntryService;
_userService = userService;
}
public void Handle(UserForgotPasswordChangedNotification notification) =>
/// <inheritdoc />
public Task HandleAsync(UserForgotPasswordChangedNotification notification, CancellationToken cancellationToken) =>
WriteAudit(
notification.PerformingUserId,
notification.AffectedUserId,
@@ -37,7 +45,8 @@ internal sealed class BackOfficeUserManagerAuditer :
"umbraco/user/password/forgot/change",
"password forgot/change");
public void Handle(UserForgotPasswordRequestedNotification notification) =>
/// <inheritdoc />
public Task HandleAsync(UserForgotPasswordRequestedNotification notification, CancellationToken cancellationToken) =>
WriteAudit(
notification.PerformingUserId,
notification.AffectedUserId,
@@ -45,7 +54,8 @@ internal sealed class BackOfficeUserManagerAuditer :
"umbraco/user/password/forgot/request",
"password forgot/request");
public void Handle(UserLoginFailedNotification notification) =>
/// <inheritdoc />
public Task HandleAsync(UserLoginFailedNotification notification, CancellationToken cancellationToken) =>
WriteAudit(
notification.PerformingUserId,
null,
@@ -53,7 +63,8 @@ internal sealed class BackOfficeUserManagerAuditer :
"umbraco/user/sign-in/failed",
"login failed");
public void Handle(UserLoginSuccessNotification notification)
/// <inheritdoc />
public Task HandleAsync(UserLoginSuccessNotification notification, CancellationToken cancellationToken)
=> WriteAudit(
notification.PerformingUserId,
notification.AffectedUserId,
@@ -61,7 +72,8 @@ internal sealed class BackOfficeUserManagerAuditer :
"umbraco/user/sign-in/login",
"login success");
public void Handle(UserLogoutSuccessNotification notification)
/// <inheritdoc />
public Task HandleAsync(UserLogoutSuccessNotification notification, CancellationToken cancellationToken)
=> WriteAudit(
notification.PerformingUserId,
notification.AffectedUserId,
@@ -69,7 +81,8 @@ internal sealed class BackOfficeUserManagerAuditer :
"umbraco/user/sign-in/logout",
"logout success");
public void Handle(UserPasswordChangedNotification notification) =>
/// <inheritdoc />
public Task HandleAsync(UserPasswordChangedNotification notification, CancellationToken cancellationToken) =>
WriteAudit(
notification.PerformingUserId,
notification.AffectedUserId,
@@ -77,7 +90,8 @@ internal sealed class BackOfficeUserManagerAuditer :
"umbraco/user/password/change",
"password change");
public void Handle(UserPasswordResetNotification notification) =>
/// <inheritdoc />
public Task HandleAsync(UserPasswordResetNotification notification, CancellationToken cancellationToken) =>
WriteAudit(
notification.PerformingUserId,
notification.AffectedUserId,
@@ -85,58 +99,52 @@ internal sealed class BackOfficeUserManagerAuditer :
"umbraco/user/password/reset",
"password reset");
private static string FormatEmail(IMembershipUser? user) =>
user is null ? string.Empty : user.Email.IsNullOrWhiteSpace() ? string.Empty : $"<{user.Email}>";
private void WriteAudit(
private async Task WriteAudit(
string performingId,
string? affectedId,
string ipAddress,
string eventType,
string eventDetails)
{
int? performingIdAsInt = ParseUserId(performingId);
int? affectedIdAsInt = ParseUserId(affectedId);
var performingIdAsInt = ParseUserId(performingId);
var affectedIdAsInt = ParseUserId(affectedId);
WriteAudit(performingIdAsInt, affectedIdAsInt, ipAddress, eventType, eventDetails);
await WriteAudit(performingIdAsInt, affectedIdAsInt, ipAddress, eventType, eventDetails);
}
private static int? ParseUserId(string? id)
=> int.TryParse(id, NumberStyles.Integer, CultureInfo.InvariantCulture, out var isAsInt) ? isAsInt : null;
private void WriteAudit(
private async Task WriteAudit(
int? performingId,
int? affectedId,
string ipAddress,
string eventType,
string eventDetails)
{
var performingDetails = "User UNKNOWN:0";
if (performingId.HasValue)
{
IUser? performingUser = _userService.GetUserById(performingId.Value);
performingDetails = performingUser is null
? $"User UNKNOWN:{performingId.Value}"
: $"User \"{performingUser.Name}\" {FormatEmail(performingUser)}";
}
IUser? performingUser = performingId is not null ? _userService.GetUserById(performingId.Value) : null;
IUser? affectedUser = affectedId is not null ? _userService.GetUserById(affectedId.Value) : null;
var affectedDetails = "User UNKNOWN:0";
if (affectedId.HasValue)
{
IUser? affectedUser = _userService.GetUserById(affectedId.Value);
affectedDetails = affectedUser is null
? $"User UNKNOWN:{affectedId.Value}"
: $"User \"{affectedUser.Name}\" {FormatEmail(affectedUser)}";
}
_auditService.Write(
performingId ?? 0,
performingDetails,
await _auditEntryService.WriteAsync(
performingUser?.Key,
FormatDetails(performingId, performingUser),
ipAddress,
DateTime.UtcNow,
affectedId ?? 0,
affectedDetails,
affectedUser?.Key,
FormatDetails(affectedId, affectedUser),
eventType,
eventDetails);
}
private static string FormatDetails(int? id, IUser? user)
{
if (user == null)
{
return $"User UNKNOWN:{id ?? 0}";
}
return user.Email.IsNullOrWhiteSpace()
? $"User \"{user.Name}\""
: $"User \"{user.Name}\" <{user.Email}>";
}
}
@@ -17,15 +17,6 @@ public class UserStartNodeEntitiesService : IUserStartNodeEntitiesService
private readonly ICoreScopeProvider _scopeProvider;
private readonly IIdKeyMap _idKeyMap;
[Obsolete("Please use the non-obsolete constructor. Scheduled for removal in V17.")]
public UserStartNodeEntitiesService(IEntityService entityService)
: this(
entityService,
StaticServiceProvider.Instance.GetRequiredService<ICoreScopeProvider>(),
StaticServiceProvider.Instance.GetRequiredService<IIdKeyMap>())
{
}
public UserStartNodeEntitiesService(IEntityService entityService, ICoreScopeProvider scopeProvider, IIdKeyMap idKeyMap)
{
_entityService = entityService;
@@ -96,10 +87,12 @@ public class UserStartNodeEntitiesService : IUserStartNodeEntitiesService
return ChildUserAccessEntities(children, userStartNodePaths);
}
int[] allowedChildIds = GetAllowedIds(userStartNodePaths, parentId);
// Need to use a List here because the expression tree cannot convert an array when used in Contains.
// See ExpressionTests.Sql_In().
List<int> allowedChildIds = GetAllowedIds(userStartNodePaths, parentId);
totalItems = allowedChildIds.Length;
if (allowedChildIds.Length == 0)
totalItems = allowedChildIds.Count;
if (allowedChildIds.Count == 0)
{
// The requested parent is outside the scope of any user start nodes.
return [];
@@ -111,7 +104,7 @@ public class UserStartNodeEntitiesService : IUserStartNodeEntitiesService
return ChildUserAccessEntities(children, userStartNodePaths);
}
private static int[] GetAllowedIds(string[] userStartNodePaths, int parentId)
private static List<int> GetAllowedIds(string[] userStartNodePaths, int parentId)
{
// If one or more of the user start nodes are descendants of the requested parent, find the "next child IDs" in those user start node paths
// that are the final entries in the path.
@@ -121,7 +114,7 @@ public class UserStartNodeEntitiesService : IUserStartNodeEntitiesService
.Where(ids => ids.Contains(parentId))
.Select(ids => ids[ids.IndexOf(parentId) + 1]) // Given the previous checks, the parent ID can never be the last in the user start node path, so this is safe
.Distinct()
.ToArray();
.ToList();
}
/// <inheritdoc />
@@ -194,9 +187,9 @@ public class UserStartNodeEntitiesService : IUserStartNodeEntitiesService
return ChildUserAccessEntities(siblings, userStartNodePaths);
}
int[] allowedSiblingIds = GetAllowedIds(userStartNodePaths, targetParent.Id);
List<int> allowedSiblingIds = GetAllowedIds(userStartNodePaths, targetParent.Id);
if (allowedSiblingIds.Length == 0)
if (allowedSiblingIds.Count == 0)
{
// The requested target is outside the scope of any user start nodes.
totalBefore = 0;
@@ -0,0 +1,18 @@
using Umbraco.Cms.Api.Management.ViewModels.NewsDashboard;
namespace Umbraco.Cms.Api.Management.Services.NewsDashboard;
/// <summary>
/// Defines a service for retrieving news dashboard items.
/// </summary>
public interface INewsDashboardService
{
/// <summary>
/// Asynchronously retrieves the collection of news dashboard items.
/// </summary>
/// <returns>
/// A task that represents the asynchronous operation.
/// The task result contains a <see cref="NewsDashboardResponseModel"/> with the retrieved news dashboard items.
/// </returns>
Task<NewsDashboardResponseModel> GetItemsAsync();
}
@@ -0,0 +1,102 @@
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Api.Management.ViewModels.NewsDashboard;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.Configuration;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Telemetry;
using Umbraco.Extensions;
namespace Umbraco.Cms.Api.Management.Services.NewsDashboard;
/// <inheritdoc />
public class NewsDashboardService : INewsDashboardService
{
private readonly AppCaches _appCaches;
private readonly IUmbracoVersion _umbracoVersion;
private readonly ISiteIdentifierService _siteIdentifierService;
private readonly ILogger<NewsDashboardService> _logger;
private readonly IBackOfficeSecurityAccessor _backOfficeSecurityAccessor;
private readonly GlobalSettings _globalSettings;
private static readonly HttpClient _httpClient = new();
/// <summary>
/// Initializes a new instance of the <see cref="NewsDashboardService"/> class.
/// </summary>
public NewsDashboardService(
AppCaches appCaches,
IUmbracoVersion umbracoVersion,
ISiteIdentifierService siteIdentifierService,
ILogger<NewsDashboardService> logger,
IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
IOptions<GlobalSettings> globalSettings)
{
_appCaches = appCaches;
_umbracoVersion = umbracoVersion;
_siteIdentifierService = siteIdentifierService;
_logger = logger;
_backOfficeSecurityAccessor = backOfficeSecurityAccessor;
_globalSettings = globalSettings.Value;
}
/// <inheritdoc />
public async Task<NewsDashboardResponseModel> GetItemsAsync()
{
const string BaseUrl = "https://umbraco-dashboard-news.euwest01.umbraco.io";
const string Path = "/api/News";
var version = _umbracoVersion.SemanticVersion.ToSemanticStringWithoutBuild();
_siteIdentifierService.TryGetOrCreateSiteIdentifier(out Guid siteIdentifier);
var language = _backOfficeSecurityAccessor.BackOfficeSecurity?.CurrentUser?.Language ?? _globalSettings.DefaultUILanguage;
var url = $"{BaseUrl}/{Path}?version={version}&siteId={siteIdentifier}&language={language}";
const string CacheKey = "umbraco-dashboard-news";
NewsDashboardResponseModel? content = _appCaches.RuntimeCache.GetCacheItem<NewsDashboardResponseModel>(CacheKey);
if (content is not null)
{
return content;
}
try
{
var json = await _httpClient.GetStringAsync(url);
if (TryMapModel(json, out NewsDashboardResponseModel? model))
{
_appCaches.RuntimeCache.InsertCacheItem(CacheKey, () => model, new TimeSpan(0, 30, 0));
content = model;
}
}
catch (Exception ex)
{
_logger.LogError(ex.InnerException ?? ex, "Error getting dashboard content from {Url}", url);
}
return content ?? new NewsDashboardResponseModel { Items = [] };
}
private bool TryMapModel(string json, [MaybeNullWhen(false)] out NewsDashboardResponseModel newsDashboardResponseModel)
{
try
{
var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true, };
List<NewsDashboardItemResponseModel>? items = JsonSerializer.Deserialize<List<NewsDashboardItemResponseModel>>(json, options);
newsDashboardResponseModel = new NewsDashboardResponseModel { Items = items ?? [] };
return true;
}
catch (JsonException ex)
{
_logger.LogError(ex.InnerException ?? ex, "Error deserializing dashboard news items");
newsDashboardResponseModel = null;
return false;
}
}
}
@@ -28,6 +28,12 @@
<PackageReference Include="Swashbuckle.AspNetCore" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Linq.Async">
<ExcludeAssets>compile</ExcludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.PublishedCache.HybridCache\Umbraco.PublishedCache.HybridCache.csproj" />
<ProjectReference Include="..\Umbraco.Cms.Api.Common\Umbraco.Cms.Api.Common.csproj" />
@@ -4,5 +4,5 @@ public abstract class ContentUrlInfoBase
{
public required string? Culture { get; init; }
public required string Url { get; init; }
public required string? Url { get; init; }
}
@@ -2,9 +2,6 @@ namespace Umbraco.Cms.Api.Management.ViewModels.Document;
public class DocumentResponseModel : DocumentResponseModelBase<DocumentValueResponseModel, DocumentVariantResponseModel>
{
[Obsolete("This property is no longer populated. Please use /document/{id}/urls instead to retrieve the URLs for a document. Scheduled for removal in Umbraco 17.")]
public IEnumerable<DocumentUrlInfo> Urls { get; set; } = Enumerable.Empty<DocumentUrlInfo>();
public ReferenceByIdModel? Template { get; set; }
public bool IsTrashed { get; set; }
@@ -2,6 +2,9 @@
namespace Umbraco.Cms.Api.Management.ViewModels.Document;
public sealed class DocumentUrlInfo : ContentUrlInfoBase
public class DocumentUrlInfo : ContentUrlInfoBase
{
public required string? Message { get; init; }
public required string Provider { get; init; }
}
@@ -5,9 +5,6 @@ namespace Umbraco.Cms.Api.Management.ViewModels.Media;
public class MediaResponseModel : ContentResponseModelBase<MediaValueResponseModel, MediaVariantResponseModel>
{
[Obsolete("This property is no longer populated. Please use /media/{id}/urls instead to retrieve the URLs for a document. Scheduled for removal in Umbraco 17.")]
public IEnumerable<MediaUrlInfo> Urls { get; set; } = Enumerable.Empty<MediaUrlInfo>();
public bool IsTrashed { get; set; }
public MediaTypeReferenceResponseModel MediaType { get; set; } = new();
@@ -4,7 +4,7 @@ namespace Umbraco.Cms.Api.Management.ViewModels.ModelsBuilderDashboard;
public class ModelsBuilderResponseModel
{
public ModelsMode Mode { get; set; }
public required string Mode { get; set; }
public bool CanGenerate { get; set; }
@@ -0,0 +1,18 @@
namespace Umbraco.Cms.Api.Management.ViewModels.NewsDashboard;
public class NewsDashboardItemResponseModel
{
public required string Priority { get; set; }
public required string Header { get; set; }
public string? Body { get; set; }
public string? ButtonText { get; set; }
public string? ImageUrl { get; set; }
public string? ImageAltText { get; set; }
public string? Url { get; set; }
}
@@ -0,0 +1,6 @@
namespace Umbraco.Cms.Api.Management.ViewModels.NewsDashboard;
public class NewsDashboardResponseModel
{
public required IEnumerable<NewsDashboardItemResponseModel> Items { get; set; }
}
@@ -0,0 +1,9 @@
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.DependencyInjection;
public class BackofficeDevelopmentComposer : IComposer
{
public void Compose(IUmbracoBuilder builder) => builder.AddBackofficeDevelopment();
}
@@ -0,0 +1,127 @@
using Microsoft.AspNetCore.Mvc.Razor.Compilation;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
using Umbraco.Extensions;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.DependencyInjection;
/*
* OVERVIEW:
*
* The CSharpCompiler is responsible for the actual compilation of razor at runtime.
* It creates a CSharpCompilation instance to do the compilation. This is where DLL references
* are applied. However, the way this works is not flexible for dynamic assemblies since the references
* are only discovered and loaded once before the first compilation occurs. This is done here:
* https://github.com/dotnet/aspnetcore/blob/114f0f6d1ef1d777fb93d90c87ac506027c55ea0/src/Mvc/Mvc.Razor.RuntimeCompilation/src/CSharpCompiler.cs#L79
* The CSharpCompiler is internal and cannot be replaced or extended, however it's references come from:
* RazorReferenceManager. Unfortunately this is also internal and cannot be replaced, though it can be extended
* using MvcRazorRuntimeCompilationOptions, except this is the place where references are only loaded once which
* is done with a LazyInitializer. See https://github.com/dotnet/aspnetcore/blob/master/src/Mvc/Mvc.Razor.RuntimeCompilation/src/RazorReferenceManager.cs#L35.
*
* The way that RazorReferenceManager works is by resolving references from the ApplicationPartsManager - either by
* an application part that is specifically an ICompilationReferencesProvider or an AssemblyPart. So to fulfill this
* requirement, we add the MB assembly to the assembly parts manager within the InMemoryModelFactory when the assembly
* is (re)generated. But due to the above restrictions, when re-generating, this will have no effect since the references
* have already been resolved with the LazyInitializer in the RazorReferenceManager. There is a known public API
* where you can add reference paths to the runtime razor compiler via it's IOptions: MvcRazorRuntimeCompilationOptions
* however this falls short too because those references are just loaded via the RazorReferenceManager and lazy initialized.
*
* The services that can be replaced are: IViewCompilerProvider (default is the internal RuntimeViewCompilerProvider) and
* IViewCompiler (default is the internal RuntimeViewCompiler). There is one specific public extension point that I was
* hoping would solve all of the problems which was IMetadataReferenceFeature (implemented by LazyMetadataReferenceFeature
* which uses RazorReferencesManager) which is a razor feature that you can add
* to the RazorProjectEngine. It is used to resolve roslyn references and by default is backed by RazorReferencesManager.
* Unfortunately, this service is not used by the CSharpCompiler, it seems to only be used by some tag helper compilations.
*
* There are caches at several levels, all of which are not publicly accessible APIs (apart from RazorViewEngine.ViewLookupCache
* which is possible to clear by casting and then calling cache.Compact(100); but that doesn't get us far enough).
*
* For this to work, several caches must be cleared:
* - RazorViewEngine.ViewLookupCache
* - RazorReferencesManager._compilationReferences
* - RazorPageActivator._activationInfo (though this one may be optional)
* - RuntimeViewCompiler._cache
*
* What are our options?
*
* a) We can copy a ton of code into our application: CSharpCompiler, RuntimeViewCompilerProvider, RuntimeViewCompiler and
* RazorReferenceManager (probably more depending on the extent of Internal references).
* b) We can use reflection to try to access all of the above resources and try to forcefully clear caches and reset initialization flags.
* c) We hack these replace-able services with our own implementations that wrap the default services. To do this
* requires re-resolving the original services from a pre-built DI container. In effect this re-creates these
* services from scratch which means there is no caches.
*
* ... Option C worked, however after a breaking change from dotnet, we cannot go with this options any longer.
* The reason for this is that when the default RuntimeViewCompiler loads in the assembly using Assembly.Load,
* This will not work for us since this loads the compiled views into the default AssemblyLoadContext,
* and our compiled models are loaded in the collectible UmbracoAssemblyLoadContext, and as per the breaking change
* you're no longer allowed reference a collectible load context from a non-collectible one
* That is the non-collectible compiled views are not allowed to reference the collectible InMemoryAuto models.
* https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/7.0/collectible-assemblies
*
* So what do we do then?
* We've had to go with option a unfortunately, and we've cloned the above classes
* There has had to be some modifications to the ViewCompiler (CollectibleRuntimeViewCompiler)
* First off we've added a new class InMemoryAssemblyLoadContextManager, the role of this class is to ensure that
* no one will take a reference to the assembly load context (you cannot unload an assembly load context if there's any references to it).
* This means that both the InMemoryAutoFactory and the ViewCompiler uses the LoadContextManager to load their assemblies.
* This serves another purpose being that it keeps track of the location of the models assembly.
* This means that we no longer use the RazorReferencesManager to resolve that specific dependency, but instead add and explicit dependency to the models assembly.
*
* With this our assembly load context issue is solved, however the caching issue still persists now that we no longer use the RefreshingRazorViewEngine
* To clear these caches another class the RuntimeCompilationCacheBuster has been introduced,
* this keeps a reference to the CollectibleRuntimeViewCompiler and the RazorViewEngine and is injected into the InMemoryModelsFactory to clear the caches when rebuilding modes.
* In order to avoid having to copy all the RazorViewEngine code the cache buster uses reflection to call the internal ClearCache method of the RazorViewEngine.
*/
public static class UmbracoBuilderExtensions
{
public static IUmbracoBuilder AddBackofficeDevelopment(this IUmbracoBuilder builder)
{
if (builder.Config.GetRuntimeMode() != RuntimeMode.BackofficeDevelopment)
{
return builder;
}
builder.AddMvcAndRazor(mvcBuilder =>
{
mvcBuilder.AddRazorRuntimeCompilation();
});
builder.AddInMemoryModelsRazorEngine();
builder.RuntimeModeValidators()
.Add<InMemoryModelsBuilderModeValidator>();
builder.AddNotificationHandler<ModelBindingErrorNotification, ModelsBuilderBindingErrorHandler>();
return builder;
}
// See notes in RefreshingRazorViewEngine for information on what this is doing.
private static IUmbracoBuilder AddInMemoryModelsRazorEngine(this IUmbracoBuilder builder)
{
// We should only add/replace these services when models builder is InMemory, otherwise we'll cause issues.
// Since these services expect the ModelsMode to be InMemoryAuto
if (builder.Config.GetModelsMode() == ModelsModeConstants.InMemoryAuto)
{
builder.Services.AddSingleton<UmbracoRazorReferenceManager>();
builder.Services.AddSingleton<CompilationOptionsProvider>();
builder.Services.AddSingleton<IViewCompilerProvider, UmbracoViewCompilerProvider>();
builder.Services.AddSingleton<RuntimeCompilationCacheBuster>();
builder.Services.AddSingleton<InMemoryAssemblyLoadContextManager>();
builder.Services.AddSingleton<InMemoryModelFactory>();
// Register the factory as IPublishedModelFactory
builder.Services.AddSingleton<IPublishedModelFactory, InMemoryModelFactory>();
return builder;
}
// This is what the community MB would replace, all of the above services are fine to be registered
builder.Services.AddSingleton<IPublishedModelFactory>(factory => factory.CreateDefaultPublishedModelFactory());
return builder;
}
}
@@ -5,7 +5,7 @@ using System.Globalization;
using Microsoft.AspNetCore.Razor.Hosting;
using Microsoft.AspNetCore.Razor.Language;
namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
/*
* This is a clone of Microsofts implementation.
@@ -2,7 +2,6 @@ using System.Collections.Concurrent;
using System.Diagnostics;
using System.Reflection;
using System.Text;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc.Razor.Compilation;
using Microsoft.AspNetCore.Razor.Hosting;
using Microsoft.AspNetCore.Razor.Language;
@@ -16,7 +15,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Primitives;
using Umbraco.Extensions;
namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
internal sealed class CollectibleRuntimeViewCompiler : IViewCompiler
{
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Razor.Language;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
/*
* This is a partial clone of the frameworks CompilationFailedExceptionFactory, a few things has been simplified to fit our needs.
@@ -9,7 +9,7 @@ using Microsoft.Extensions.DependencyModel;
using Microsoft.Extensions.Hosting;
using DependencyContextCompilationOptions = Microsoft.Extensions.DependencyModel.CompilationOptions;
namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
/*
* This is a partial Clone'n'Own of microsofts CSharpCompiler, this is just the parts relevant for getting the CompilationOptions
@@ -1,8 +1,7 @@
using System.Reflection;
using System.Runtime.Loader;
using Umbraco.Cms.Infrastructure.ModelsBuilder;
namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
internal sealed class InMemoryAssemblyLoadContextManager
{
@@ -8,7 +8,6 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Configuration;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Extensions;
using Umbraco.Cms.Core.Hosting;
@@ -20,7 +19,7 @@ using Umbraco.Extensions;
using File = System.IO.File;
using IHostingEnvironment = Umbraco.Cms.Core.Hosting.IHostingEnvironment;
namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto
{
internal sealed partial class InMemoryModelFactory : IAutoPublishedModelFactory, IRegisteredObject, IDisposable
{
@@ -143,7 +142,7 @@ namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto
}
/// <inheritdoc />
public bool Enabled => _config.ModelsMode == ModelsMode.InMemoryAuto;
public bool Enabled => _config.ModelsMode == ModelsModeConstants.InMemoryAuto;
public IPublishedElement CreateModel(IPublishedElement element)
{
@@ -0,0 +1,32 @@
using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Infrastructure.Runtime;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
/// <summary>
/// Validates that the ModelsBuilder mode is not set to InMemoryAuto when in development runtime mode.
/// </summary>
public class InMemoryModelsBuilderModeValidator : IRuntimeModeValidator
{
private readonly IOptionsMonitor<ModelsBuilderSettings> _modelsBuilderSettings;
public InMemoryModelsBuilderModeValidator(IOptionsMonitor<ModelsBuilderSettings> modelsBuilderSettings)
{
_modelsBuilderSettings = modelsBuilderSettings;
}
public bool Validate(RuntimeMode runtimeMode, [NotNullWhen(false)] out string? validationErrorMessage)
{
if (runtimeMode != RuntimeMode.BackofficeDevelopment &&
_modelsBuilderSettings.CurrentValue.ModelsMode == ModelsModeConstants.InMemoryAuto)
{
validationErrorMessage = "ModelsBuilder mode cannot be set to InMemoryAuto in development mode.";
return false;
}
validationErrorMessage = null;
return true;
}
}
@@ -1,4 +1,4 @@
namespace Umbraco.Cms.Infrastructure.ModelsBuilder;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
/// <summary>
/// Indicates that an Assembly is a Models Builder assembly.
@@ -0,0 +1,64 @@
using System.Reflection;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Notifications;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
internal sealed class ModelsBuilderBindingErrorHandler : INotificationHandler<ModelBindingErrorNotification>
{
/// <summary>
/// Handles when a model binding error occurs.
/// </summary>
public void Handle(ModelBindingErrorNotification notification)
{
ModelsBuilderAssemblyAttribute? sourceAttr =
notification.SourceType.Assembly.GetCustomAttribute<ModelsBuilderAssemblyAttribute>();
ModelsBuilderAssemblyAttribute? modelAttr =
notification.ModelType.Assembly.GetCustomAttribute<ModelsBuilderAssemblyAttribute>();
// if source or model is not a ModelsBuider type...
if (sourceAttr == null || modelAttr == null)
{
// if neither are ModelsBuilder types, give up entirely
if (sourceAttr == null && modelAttr == null)
{
return;
}
// else report, but better not restart (loops?)
notification.Message.Append(" The ");
notification.Message.Append(sourceAttr == null ? "view model" : "source");
notification.Message.Append(" is a ModelsBuilder type, but the ");
notification.Message.Append(sourceAttr != null ? "view model" : "source");
notification.Message.Append(" is not. The application is in an unstable state and should be restarted.");
return;
}
// both are ModelsBuilder types
var pureSource = sourceAttr.IsInMemory;
var pureModel = modelAttr.IsInMemory;
if (sourceAttr.IsInMemory || modelAttr.IsInMemory)
{
if (pureSource == false || pureModel == false)
{
// only one is pure - report, but better not restart (loops?)
notification.Message.Append(pureSource
? " The content model is in memory generated, but the view model is not."
: " The view model is in memory generated, but the content model is not.");
notification.Message.Append(" The application is in an unstable state and should be restarted.");
}
else
{
// both are pure - report, and if different versions, restart
// if same version... makes no sense... and better not restart (loops?)
Version? sourceVersion = notification.SourceType.Assembly.GetName().Version;
Version? modelVersion = notification.ModelType.Assembly.GetName().Version;
notification.Message.Append(" Both view and content models are in memory generated, with ");
notification.Message.Append(sourceVersion == modelVersion
? "same version. The application is in an unstable state and should be restarted."
: "different versions. The application is in an unstable state and should be restarted.");
}
}
}
}
@@ -0,0 +1,6 @@
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
public class ModelsModeConstants
{
public const string InMemoryAuto = "InMemoryAuto";
}
@@ -4,7 +4,7 @@ using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Text;
using Microsoft.Extensions.DependencyModel;
namespace Umbraco.Cms.Infrastructure.ModelsBuilder;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
public class RoslynCompiler
{
@@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Mvc.Razor.Compilation;
using Umbraco.Cms.Core;
namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
internal sealed class RuntimeCompilationCacheBuster
{
@@ -1,7 +1,7 @@
using System.Reflection;
using System.Runtime.Loader;
namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
internal sealed class UmbracoAssemblyLoadContext : AssemblyLoadContext
{
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Diagnostics;
namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
internal sealed class UmbracoCompilationException : Exception, ICompilationException
{
@@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Options;
namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
/*
@@ -7,7 +7,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Exceptions;
namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto;
namespace Umbraco.Cms.DevelopmentMode.Backoffice.InMemoryAuto;
internal sealed class UmbracoViewCompilerProvider : IViewCompilerProvider
{
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Title>Umbraco CMS - DevelopmentMode - Backoffice</Title>
<Description>Adds backoffice development mode.</Description>
<RootNamespace>Umbraco.Cms.DevelopmentMode.Backoffice</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Web.Common\Umbraco.Web.Common.csproj" />
</ItemGroup>
</Project>
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Headers;
using Microsoft.Extensions.Options;
using Microsoft.Net.Http.Headers;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Webp;
using SixLabors.ImageSharp.Web.Commands;
using SixLabors.ImageSharp.Web.Middleware;
@@ -1,7 +1,10 @@
using System.Globalization;
using System.Numerics;
using Microsoft.Extensions.Logging;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Web;
using SixLabors.ImageSharp.Web.Commands;
using SixLabors.ImageSharp.Web.Processors;
@@ -1,3 +1,4 @@
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
using Umbraco.Cms.Core.Media;
@@ -3,6 +3,8 @@ using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Web;
using SixLabors.ImageSharp.Web.Middleware;
using SixLabors.ImageSharp.Web.Processors;
using Umbraco.Cms.Core.DependencyInjection;

Some files were not shown because too many files have changed in this diff Show More