Commit Graph

87 Commits

Author SHA1 Message Date
Nikolaj Geisle
74db02c444 V14: Don't add published culture infos if not published (#15370)
* Don't add published infos if not published

* Unpublish all cultures as a whole

* Added tests

---------

Co-authored-by: Bjarke Berg <mail@bergmania.dk>
2024-02-01 08:33:14 +01:00
Kenn Jacobsen
aaf7075313 Property level validation for Management API (#15644)
* Property level validation for content - initial implementation

* Always succeed create/update regardless of property level validation errors

* Move old complex editor validation classes to Web.BackOffice so they will be deleted

* Include operation status and property validation errors in ProblemDetails

* Refactor property validation to its own service(s)

* Make the problem details builder a little more generic towards extensions

* Validation for item and branch publish

* Moved malplaced test

* Get rid of a TODO

* Integration tests for content validation service

* Simplify validation service

* Add missing response types to create and update for document and media

* Remove test that no longer applies

* Use "errors" for model validation errors (property validation errors)

* Split create/update and validation into their own endpoints

* Fix forward merge

* Correct wrong assumption for missing properties

* Remove localization from validation error messages - decreases dependencies, adds a lot of obsolete constructors

* Reuse existing validation service + support custom error messages

* Fix merge errors

* Review comments
2024-01-31 10:40:58 +01:00
Sven Geusens
26761cc04a Implemented culture based authorization for content (#15580)
* Implemented culture based authorization for content

* Implemented culture auth for create/update of documents

* Applied culture authorization to dictionary create/update

* Added an integration test to test an assumption about the ContentTypeEditingService.CreateAsync method

* Fix processing when result is already false;

* Apply suggestions from code review

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

* Refactor method to async + clarify and consilidate comments regarding dictionary locks

---------

Co-authored-by: Sven Geusens <sge@umbraco.dk>
Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
2024-01-22 21:08:20 +01:00
Elitsa Marinovska
547da0b191 V14: Composition endpoints for Document and Media types (#15584)
* Adding response/request models

* Adding mapping

* Adding factory

* Adding controllers

* Moved to correct (generic domain) namespace

* Renamed to reflect the correct domain + renamed IsAllowed to IsCompatible

* Renaming + TODO

* Removed presentation logic + TODO

* Fixed controller

* Attempt for generic implementation

* Enable composition of media types + refactor content/media type editing tests to prove it (and a little renaming of a mis-named property)

* Remove unused classes

* Introducing GetAvailableCompositionsAsync to EditingServices

* Implement GetAvailableCompositionsAsync

* Base share implementation

* Tests

* Tests

* Renaming

* Clean up controller

* Clean up test

* Remove redundant check

* Create and use generic models

* Add shared implementation

* Fix and rename doc type mapper

* Fix document Type factory

* Add missing response type

* Create a base request model

* Make key nullable when new item

* Media type response models

* Default isElement to false and remove isElement param from media type related things

* Create mappings for media type compositions

* Inject generic base service to reuse implementation amongst concrete services

* Add new composition endpoints for media type

* Use specific type

* Add a reference comment to other test suite

* Add more test cases

---------

Co-authored-by: kjac <kja@umbraco.dk>
2024-01-17 08:36:27 +01:00
Kenn Jacobsen
f9ecd9514e Management API should expose if a user group is a system group (#15333) 2023-12-01 09:39:27 +01:00
Kenn Jacobsen
012b43a1c2 Publishing in the Management API (#14774)
* make CoreScopeProvider available for derived classes

* Create publish controller

* Add publish functionality

* Remove unneeded using

* Implement publish for multiple cultures

* support multiple cultures in controler

* Dont validate properties

* Refactor to use PublishingOperationStatus

* refactor to use proper publish async methods

* Refactor publish logic into own service

* Commit some demo code

* Add notes about what errors can happen when publishing

* Rework ContentPublishingService and introduce explicit Publish and PublishBranch methods in ContentService

* Fix merge

* Allow the publishing strategy to do its job

* Improved check for unsaved changes

* Make the old content controller work (as best possible)

* Remove SaveAndPublish (SaveAndPublishBranch) from all tests

* Proper guards for invalid cultures when publishing

* Fix edge cases for property validation and content unpublishing + add unpublishing to ContentPublishingService

* Clear out a few TODOs - we'll accept the behavior for now

* Unpublish controller

* Fix merge

* Fix branch publish notifications

* Added extra test for publishing unpublished cultures and added FIXME comments for when we fix the state of published cultures in content

---------

Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
Co-authored-by: Zeegaan <nge@umbraco.dk>
2023-11-22 12:52:08 +01:00
Bjarke Berg
fb55e1b244 Merge remote-tracking branch 'origin/v13/dev' into v14/dev
# Conflicts:
#	src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
#	src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Repositories.cs
#	src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs
#	src/Umbraco.Infrastructure/PropertyEditors/MultiUrlPickerValueEditor.cs
2023-11-14 13:22:10 +01:00
Bjarke Berg
c22783e45e Merge remote-tracking branch 'origin/release/13.0' into v13/dev 2023-11-14 12:43:11 +01:00
Kenn Jacobsen
4d98937af9 Delivery API nested property expansion and output limiting (#15124)
* V2 output expansion + field limiting incl. deprecation of V1 APIs

* Performance optimizations for Content and Block based property editors

* A little formatting

* Support API versioning in Delivery API endpoint matcher policy

* Add V2 "expand" and "fields" to Swagger docs

* Renamed route for "multiple items by ID"

* Review changes

* Update src/Umbraco.Cms.Api.Delivery/Controllers/Media/ByIdMediaApiController.cs

Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>

* Update src/Umbraco.Cms.Api.Delivery/Filters/SwaggerDocumentationFilterBase.cs

Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>

* Update src/Umbraco.Cms.Api.Delivery/Filters/SwaggerDocumentationFilterBase.cs

Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>

* Revert "Performance optimizations for Content and Block based property editors"

This reverts commit 0d5a57956b36e94ce951f1dad7a7f3f43eb1f60b.

* Introduce explicit API cache levels for property expansion

* Friendly handling of bad expand/fields parameters

---------

Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>
2023-11-14 11:16:12 +01:00
Bjarke Berg
162a6a0085 Post merge 2023-11-14 09:39:39 +01:00
Nikolaj Geisle
0e8c92a6e7 V13: Refactor webhookservice to attempt pattern (#15180)
* Refactor IWebhookService to attempt pattern

* Remove unwanted file

* Fix up tests

* Fix after merge

---------

Co-authored-by: Zeegaan <nge@umbraco.dk>
2023-11-13 18:36:05 +01:00
Nikolaj Geisle
46df3a05a7 V13: request queueing (#15176)
* Implement persistence

* Start implementing repository

* Implement repository

* Implement request service

* Dont run WebhookFiring if not in runtime mode run

* Refactor repository and service to have full CRUD

* add tests for Request service

* Implement WebhookRequest lock

* Register hosted service

* Add try catch when firing HttpRequest

* Add migration

* Refactor to use renamed IWebhookService

* Refactor tests too

* Add setting to configure webhook firing period

* Update docs

* Review fixes

* Add column renaming migration

* Remove unused service

* run request in parralel

* Refactor to fire parallel in background

---------

Co-authored-by: Zeegaan <nge@umbraco.dk>
Co-authored-by: Bjarke Berg <mail@bergmania.dk>
2023-11-13 15:49:02 +01:00
Nikolaj Geisle
e143133bcf V13: Update IWebHookService to proper casing (#15169)
* Update to proper casing

* Fixed naming

---------

Co-authored-by: Zeegaan <nge@umbraco.dk>
Co-authored-by: Andreas Zerbst <andr317c@live.dk>
2023-11-10 08:20:22 +01:00
Nikolaj Geisle
7bde16b4ef V13: Add eventype to webhookevents (#15157)
* Refactor IWebhookEvent to contain event type.

* refactor frontend to filter on eventType.

* Display event names

* refactor to use eventNames

* remove npm from overview

* implement alias for WebhookEvents

* Implement [WebhookEvent] attribute

* Refactor IWebhookService to get by event alias and not name

* Rename parameter to fit method name

* to lower event type to avoid casing issues

* Apply suggestions from code review

Co-authored-by: Ronald Barendse <ronald@barend.se>

* Change event names from constants to hard coded. And give more friendly names

* Refactor to not use event names, where it was not intended

* Add renaming column migration

* display event alias in logs

* Update migration to check if old column is there

* Apply suggestions from code review

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

* add determineResource function to avoid duplicate code

---------

Co-authored-by: Zeegaan <nge@umbraco.dk>
Co-authored-by: Ronald Barendse <ronald@barend.se>
Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>
2023-11-09 14:18:34 +01:00
Bjarke Berg
fd0c233362 Merge remote-tracking branch 'origin/v13/dev' into v14/dev 2023-11-08 05:53:03 +01:00
Erik-Jan Westendorp
c0ca4685e8 Fix FurthestAncestorOrSelfDynamicRootQueryStep and FurthestDescendantOrSelfDynamicRootQueryStep (#15113)
* Rename FarthestDescendantOrSelfDynamicRootQueryStep to FurthestDescendantOrSelfDynamicRootQueryStep

* Rename FarthestAncestorOrSelfDynamicRootQueryStep to FurthestAncestorOrSelfDynamicRootQueryStep

* Update integration test and repo
2023-11-06 10:44:12 +01:00
kjac
e864f3eb05 Fix merge errors and port blocks in RTE implementation to V14 format (strongly typed, no magic JObjects) 2023-11-02 11:55:12 +01:00
Bjarke Berg
ef80e25aa6 Merge remote-tracking branch 'origin/v13/dev' into v14/dev
# Conflicts:
#	build/azure-pipelines.yml
#	src/Umbraco.Core/Constants-Configuration.cs
#	src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs
#	src/Umbraco.Core/Factories/IDatabaseSettingsFactory.cs
#	src/Umbraco.Core/Factories/IInstallSettingsFactory.cs
#	src/Umbraco.Core/Factories/IUpgradeSettingsFactory.cs
#	src/Umbraco.Core/Factories/InstallSettingsFactory.cs
#	src/Umbraco.Core/Factories/UpgradeSettingsFactory.cs
#	src/Umbraco.Core/Factories/UserSettingsFactory.cs
#	src/Umbraco.Core/Installer/IInstallStep.cs
#	src/Umbraco.Core/Installer/IUpgradeStep.cs
#	src/Umbraco.Core/Installer/NewInstallStepCollection.cs
#	src/Umbraco.Core/Installer/NewInstallStepCollectionBuilder.cs
#	src/Umbraco.Core/Installer/Steps/FilePermissionsStep.cs
#	src/Umbraco.Core/Installer/Steps/RestartRuntimeStep.cs
#	src/Umbraco.Core/Installer/Steps/TelemetryIdentifierStep.cs
#	src/Umbraco.Core/Installer/UpgradeStepCollection.cs
#	src/Umbraco.Core/Installer/UpgradeStepCollectionBuilder.cs
#	src/Umbraco.Core/Models/Blocks/RichTextBlockLayoutItem.cs
#	src/Umbraco.Core/Models/Blocks/RichTextEditorBlockDataConverter.cs
#	src/Umbraco.Core/Models/Configuration/NewBackOfficeSettings.cs
#	src/Umbraco.Core/Models/Configuration/NewBackOfficeSettingsValidator.cs
#	src/Umbraco.Core/Models/Installer/ConsentLevelModel.cs
#	src/Umbraco.Core/Models/Installer/DatabaseInstallData.cs
#	src/Umbraco.Core/Models/Installer/DatabaseSettingsModel.cs
#	src/Umbraco.Core/Models/Installer/InstallData.cs
#	src/Umbraco.Core/Models/Installer/InstallSettingsModel.cs
#	src/Umbraco.Core/Models/Installer/PasswordSettingsModel.cs
#	src/Umbraco.Core/Models/Installer/UpgradeSettingsModel.cs
#	src/Umbraco.Core/Models/Installer/UserInstallData.cs
#	src/Umbraco.Core/Models/Installer/UserSettingsModel.cs
#	src/Umbraco.Core/Models/OutOfDateType.cs
#	src/Umbraco.Core/PaginationHelper.cs
#	src/Umbraco.Core/Services/Installer/IInstallService.cs
#	src/Umbraco.Core/Services/Installer/IUpgradeService.cs
#	src/Umbraco.Core/Services/Installer/InstallService.cs
#	src/Umbraco.Core/Services/Installer/UpgradeService.cs
#	src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Repositories.cs
#	src/Umbraco.Infrastructure/Factories/Installer/DatabaseSettingsFactory.cs
#	src/Umbraco.Infrastructure/Installer/Steps/CreateUserStep.cs
#	src/Umbraco.Infrastructure/Installer/Steps/DatabaseConfigureStep.cs
#	src/Umbraco.Infrastructure/Installer/Steps/DatabaseInstallStep.cs
#	src/Umbraco.Infrastructure/Installer/Steps/DatabaseUpgradeStep.cs
#	src/Umbraco.Infrastructure/Installer/Steps/RegisterInstallCompleteStep.cs
#	src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs
#	src/Umbraco.Infrastructure/Models/Blocks/BlockEditorDataConverter.cs
#	src/Umbraco.Infrastructure/PropertyEditors/BlockEditorPropertyValueEditor.cs
#	src/Umbraco.Infrastructure/PropertyEditors/BlockEditorValidator.cs
#	src/Umbraco.Infrastructure/PropertyEditors/BlockEditorValues.cs
#	src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyEditor.cs
#	src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockGridPropertyValueConverter.cs
#	src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockListPropertyValueConverter.cs
#	src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockPropertyValueConverterBase.cs
#	src/Umbraco.Infrastructure/Security/IBackOfficeApplicationManager.cs
#	src/Umbraco.Infrastructure/Services/IIndexingRebuilderService.cs
#	src/Umbraco.Infrastructure/Services/IndexingRebuilderService.cs
#	src/Umbraco.New.Cms.Core/Umbraco.New.Cms.Core.csproj
#	src/Umbraco.New.Cms.Infrastructure/Umbraco.New.Cms.Infrastructure.csproj
#	src/Umbraco.New.Cms.Web.Common/Umbraco.New.Cms.Web.Common.csproj
#	tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/content.spec.ts
#	tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Login/login.spec.ts
#	tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockListPropertyValueConverterTests.cs
#	version.json
2023-11-01 13:50:38 +01:00
Zeegaan
eb355f4ab6 Compare invariant to string instead, as SqlServer rounds DateTime 2023-10-31 12:30:12 +01:00
Bjarke Berg
6658a521b2 Dynamic Root (Alternative to XPath in MNTP) (#15035)
* Temp commit.. Initial work on XPath alternative for dymamically finding start nodes

* First commit that goes all the way from ui to db for NearestAncestorOrSelf

* Added more filters + return null from controller instead of not found

* Bugfix

* rewrite query to make sqlserver happy?

* Added more tests

* clean up initial step

* Added tests and refactor

* Update endpoint to take model instead of json

* pick origin

* Use model for config instead of string

* append add filter button

* fix

* default filter

* rename json fields

* correct field names

* minor corrections

* Renaming..

* Rename endpoint

* initial work for appending query steps

* query steps ui

* more localization

* query step UI

* Use doc type keys instead of alias

* only for Documents

* change to send keys to anyOfDocTypeKeys

* Fix potential bug

* Fix when level is impossible to get

* correct prop to dynamicRoot

* noValidStartNode dialog

* custom query step

* Renaming

* Rollback unintended file change

* Fixed issue if no doc type is chosen

* Remove unintended file changes

* More unintended changes

* Renaming

* Optimizations

- IDE Recommendation for better source
- Renaming for better clarity
- Improving spacing/formatting
- Typo corrections
- Remove warnings concerning IEnumerable

* Fix failed attempt bug

---------

Co-authored-by: Niels Lyngsø <niels.lyngso@gmail.com>
Co-authored-by: Sven Geusens <sge@umbraco.dk>
2023-10-31 11:38:24 +01:00
Nikolaj Geisle
1b34d33eb7 Webhooks administration from Backoffice (#15050)
* Create webhook models

* Define interfaces for service and repository

* Create Webhook dto and corresponding factory

* implement WebhookRepository.cs

* Remove entity name from models, as that should be resolved in mapping instead

* Add new table to schema creator

* Register repo for DI

* Remove more mentions of entityname

* Refactor repository to guids

* Implement WebhookService

* Use scopes in service

* Start creating tests for service

* Refactor delete to use Id and not entire entity

* Rework Webhooks to be able to have multiple entity keys

* Implement GetAll functionality

* Implement webhook controller

* Imeplement get all events action

* Add equalityComparer deletegate to Webhook

* Add datacontract attirbutes to properties

* Implement backoffice webhooks tree

* Implement first webhooks menu

* Make WebHookController authorized

* Update to have tabs with webhooks and logs

* Enable create overlay

* Push to entityKeys array

* Fix up pagination

* Implement delete functionality

* remove pagination

* add log view

* Fix create to be able to select more than one content type

* implement type name resolving for content

* Refactor to use less duplication

* Implement update functionality in frontend

* Rename database table

* Make multiple events possible

* create new event picker

* Refactor to actually add new database table with proper name

* Make it possible to select multiple events

* Fix updating current items

* Fix up update functionality after db rework

* Add webhook icon

* Switch to match heartcore icons

* Refactor to use bases instead of Enum

* Refactor to make IWebhookEvent to Collection, so it can be injected instead of using reflection

* Fix up frontend to match new models

* Fix integration tests

* Remove obsolete entity key from webhookdto

* Introduce constants instead of hard coded strings

* Start implementation of firing mechanism

* Add new GetByEventName method

* Add 1 to many list on WebhookDto

* Implement new repository pattern

* Implement GetByEventName

* Fix up repository to use all async

* Refactor events to fire

* Refactor WebhookEvents to be more DRY

* Add custom header

* Start implementing log repository

* Implement GetPaged

* Implement WebhookLogService

* Implement GetLogs

* Add url to webhook log

* Implement log overview

* Formatting

* Implement details view

* Refactor to get actual retry count

* Refactor firing to fire only when Enabled

* Add Status code to detailed view

* Add configuration to disable webhooks entirely

* Implement custom headers frontend

* Implement persistence of custom headers

* Refactor retry service to also retry on non success status codes.

* Refactor registration of Webhooks, to also register as NotificationHandler

* Add webhooks migration

* Add key for adding webhook headers

* Fix up test

* Change event icon to flag

* Remember event, when editing what events you have chosen

* Refactor reflection to check if INotificationAsyncHandler instead

* Formatting

* Refactor webhook model to no longer derive from EntityBase

* Rename entityKeys to content keys

* Rename controller to lowercase H

* Add null check before trying to access selectedEvents

* Add configuration for maximum number of retries

* Add index to date

* Add webhook Key to logs

* Check for SchedulingPublisher before sending webhooks

* rename requestObject to payload

* Refactor event to send appropriate payloads

* Refactor logging to happen for every try.

* Order date by descending

* Add todo

* Change firing service to use String not ByteContent

* Update Headers to Interface instead of concrete implementation

* Dont return if a table exists already

* Rename updateModel to webhook

* Annotate WebhookController.cs with PluginController attribute

* Add danish translations

* Do not check if fail

* Dont filter when selecting custom items

* Remove delay from WebhookFiringService

---------

Co-authored-by: Zeegaan <nge@umbraco.dk>
2023-10-31 10:06:14 +01:00
Bjarke Berg
49c71b1989 Merge 2023-09-20 14:13:21 +02:00
Bjarke Berg
ed73b82fd0 Merge remote-tracking branch 'origin/v11/dev' into v12/dev
# Conflicts:
#	tests/Umbraco.Tests.Integration/NewBackoffice/OpenAPIContractTest.cs
#	tests/Umbraco.Tests.Integration/Umbraco.Core/Services/ContentServiceTests.cs
2023-09-20 09:51:56 +02:00
Jacob Overgaard
7bbe994fc9 Merge remote-tracking branch 'origin/v10/dev' into v11/dev
# Conflicts:
#	src/Umbraco.Web.UI.Client/src/less/components/umb-property-editor.less
2023-09-14 13:20:55 +02:00
Sven Geusens
c8e054baa2 V10/feature/pipeline test filters (#14766)
* Add configuration/code to not run certain tests based on variables/release builds

* Applied longrunning testAttribute to the worst offenders (>200ms on my machine)

* Fix yaml notation

* split up windows/non windows test runs

* Added supression for moved tests

* Fix yaml validation issues

* Change yaml string parameter null value to empty string

* Convert empty strings to whitespace strings

* Rename and cleanup some paramater to better reflect why we use them

* Nightly build test

* Change nightly build authentication type

* template paramater fix

* Update nightly pipeline name

---------

Co-authored-by: Sven Geusens <sge@umbraco.dk>
2023-09-12 14:16:27 +02:00
Bjarke Berg
4f5fc0b8a1 Bulk delete functionality for management api (#14735)
* Bulk delete

* Bulk delete

* Added bulk delete user groups

* Clean

---------

Co-authored-by: Nikolaj <nikolajlauridsen@protonmail.ch>
2023-08-29 15:51:20 +02:00
Bjarke Berg
b8af4bab7d User forgot password functionality for Management API (#14704)
* Added attribute filter to ensure a request is taking a minimum time to response

* Added functionality to management api to send forgot password emails and verify these + do the actual reset using the token

* Renamed UserKey to UserId and updated OpenApi.json

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

Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>

* Cleanup

* Renaming param

* Fixing send user username instead of email + wrong EmailTypes

* Fixed issue with forgot password functionality after reusing other functionality

* Rename prop

* Adding docs and renaming param

* Handle password validation return types

* More cleanup

---------

Co-authored-by: Elitsa <elm@umbraco.dk>
Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>
2023-08-28 12:14:16 +02:00
Kenn Jacobsen
0096addcb9 Content and media type CRUD controllers and services (#14665)
* Add GetAsync method

* Fix up delete document type controller

* Add scope to delete async

* Add some scaffolding

* Add create model

* Start working on validation

* Move validation to its own service

* Use GetAllAsync instead of GetAsync

* Add initial composition support

Still need to figure out some kinks

* Validate compositions when creating

* Add initial folder support

* Initial handling of generic properties

* Add operation status responses

* Move create operation into service

* Add first test

* Fix issued shown by test

* Ensure a specific key can be specified when creating

* Rename container id to container key

Let's try and be consistent

* Create basic composition test

* Ensure new property groups are created with the correct key

* Add test showing property type issue

* Fix property types not using the expected key.

* Validate against model fetched from content type service

Just to make sure nothing explodes on the round trip

* Make helper for creating create models

* Add helper for creating container

* Make helper methods simpler to use

* Add test for compositions using compositions

* Add more composition tests

* Fix bug allowing element types to be composed by non element types

* Remove validators

This can just be a part of the editing service

* Minor cleanup

* Ensure that multiple levels of inheritance is possible

* Ensure doctype cannot be used as both composition and inheritance on the same doctype

* Ensure no duplicate aliases from composition and that compositions exists

* Minor cleanup

* Address todos

* Add SaveAsync method

* Renamed some models

* Rename from DocumentType to ContentType

* Clarify ParentKey as being container only + untangle things a tiny bit

* Clean out another TODO (less duplicate code) + more tests

* Refactor for reuse across different content types + add media type editing service + unit tests

* Refactor in preparation for update handling

* More tests + fixed bugs found while testing

* Simplify things a bit

* Content type update + a lot of unit tests + some refactor + fix bugs found while testing

* Begin building presentation factories for mapping view models to editing models

* Use async save

* Mapping factories and some clean-up

* Rename Key to Id (ParentKey to ParentId)

* Fix slight typo

* Use editing service in document type controllers and introduce media type controllers

* Validate containers and align container aliases with the current backoffice

* Remove ParentId from response

* Fix scope handling in DeleteAsync

* Refactor ContentTypeSort

* A little renaming for clarity + safeguard against changes to inheritance

* Persist allowed content types

* Fix bad merge + update controller response annotations

* Update OpenAPI JSON

* Update src/Umbraco.Cms.Api.Management/Controllers/DocumentType/DocumentTypeControllerBase.cs

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

* Fix review comments

* Update usage of MapCreateAsync to ValidateAndMapForCreationAsync

---------

Co-authored-by: Nikolaj <nikolajlauridsen@protonmail.ch>
2023-08-17 12:28:16 +02:00
Mole
a1f6531453 V14: Consistently refer to user key (#14685)
* Fixup UserService

* Fixup PartialViewService

* Fixup ScriptService

* Fixup StylesheetService

* Use keys with usergroups instead of IDs

* Fix missed instances of performingUser

* Fixup DataTypeFolderControllerBase

---------

Co-authored-by: kjac <kja@umbraco.dk>
2023-08-17 08:35:48 +02:00
Nikolaj Geisle
e40f1839c4 V14: Refactor LogViewerService (#14511)
* Refactor GetPagedLogsAsync to not use ILogViewer

* Refactor GetPagedLogsAsync to not use ILogViewer

* Reorder using statements

* Introduce ILogViewerRepository

* Remove skip and take from repository

* Return IEnumerable instead of pagedModel

* Remove local GetLogs

* Return IEnumerable instead of pagedmodel

* Remove serilog entirely from ILogViewerService

* Move LogViewerService

* Inject LogViewerService as core service instead

* Implement LogViewerServiceTests.cs

* Add more happy path tests

* Add saved query tests

* Refactor private path fields  to normal variables in setup method

* Capitalize logs for Unix systems

* Added missing documentation

---------

Co-authored-by: Zeegaan <nge@umbraco.dk>
Co-authored-by: Elitsa <elm@umbraco.dk>
2023-07-10 15:36:20 +03:00
Bjarke Berg
22b2f79d15 Merge remote-tracking branch 'origin/v12/dev' into v14/dev
# Conflicts:
#	src/Umbraco.Cms.Api.Common/DependencyInjection/UmbracoBuilderApiExtensions.cs
#	src/Umbraco.Core/CompatibilitySuppressions.xml
#	src/Umbraco.Infrastructure/CompatibilitySuppressions.xml
#	src/Umbraco.Web.Common/Profiler/WebProfiler.cs
2023-06-21 09:06:42 +02:00
Mole
446544c045 V12: Add deliver api information to detailed telemetry (#14418)
* Add deliver api information to detailed telemetry

* Update translation
2023-06-20 12:03:46 +02:00
Mole
040bf2c1e3 Replace use of SortedSet with HashSets and ISets (#14353) 2023-06-08 10:30:23 +02:00
Bjarke Berg
c84a3e2fe4 Merge remote-tracking branch 'origin/v12/dev' into release/14.0
# Conflicts:
#	src/Umbraco.Core/Manifest/PackageManifest.cs
#	src/Umbraco.Core/Telemetry/TelemetryService.cs
#	src/Umbraco.Infrastructure/Manifest/LegacyManifestParser.cs
#	src/Umbraco.Infrastructure/Migrations/Upgrade/V_12_0_0/ResetCache.cs
#	src/Umbraco.Infrastructure/Persistence/Repositories/Implement/CreatedPackageSchemaRepository.cs
#	src/Umbraco.Infrastructure/Services/Implement/PackagingService.cs
#	tests/Umbraco.Tests.UnitTests/Umbraco.Core/Telemetry/TelemetryServiceTests.cs
2023-06-08 10:07:29 +02:00
Bjarke Berg
96dc594269 Merge remote-tracking branch 'origin/v11/dev' into release/12.0
# Conflicts:
#	tests/Umbraco.Tests.Integration/Umbraco.Examine.Lucene/UmbracoExamine/IndexTest.cs
#	version.json
2023-06-08 08:37:30 +02:00
nikolajlauridsen
537e078d43 Merge branch 'release/12.0' into v12/dev 2023-06-06 13:52:17 +02:00
Bjarke Berg
dbfedf31bd Merge remote-tracking branch 'origin/v12/dev' into v14/dev 2023-05-31 09:46:59 +02:00
Bjarke Berg
82746518d4 Merge remote-tracking branch 'origin/v11/dev' into v12/dev
# Conflicts:
#	tests/Umbraco.Tests.Integration/Umbraco.Examine.Lucene/UmbracoExamine/IndexTest.cs
#	version.json
2023-05-31 09:11:24 +02:00
Bjarke Berg
2407d42de6 Merge remote-tracking branch 'origin/v10/dev' into v11/dev
# Conflicts:
#	src/Umbraco.Core/Constants-Telemetry.cs
#	tests/Umbraco.Tests.Integration/Umbraco.Core/Telemetry/TelemetryServiceTests.cs
2023-05-31 08:48:28 +02:00
Kenn Jacobsen
3b433e6658 Expose "expanding" state in API value conversion (#14312)
* Expose "expanding" state in API value conversion

* Add unit test

* Add non-breaking and obsoletion

* Add compat suppressions
2023-05-31 08:46:30 +02:00
Mole
999a83995e V10: Add external login provider count to detailed telemetry (#14282)
* Add backoffice external login provider count to telemetry

* Update translation

* Fix integration test
2023-05-24 11:48:56 +02:00
Mole
f615e7bcfc Only consider alias duplicate if the key matches (#14169) 2023-05-09 10:46:31 +02:00
Bjarke Berg
5dd945f372 Reintroduced management api after v12 merge 2023-05-09 09:21:16 +02:00
Bjarke Berg
0f1c2f7022 Ensure no management api for v12 (#14197)
* Remove management api

* Remove actual files
2023-05-04 13:32:41 +02:00
Bjarke Berg
fff393c9ed Merge remote-tracking branch 'origin/v12/dev' into v13/dev
# Conflicts:
#	src/Umbraco.Cms.Api.Management/ManagementApiComposer.cs
#	src/Umbraco.Core/CompatibilitySuppressions.xml
#	src/Umbraco.Infrastructure/CompatibilitySuppressions.xml
2023-04-19 11:42:01 +02:00
Bjarke Berg
c06e89af64 Content Delivery API (#14051)
* Add the core parts of the headless PoC

* Add Content API project (WIP - loads of TODOs and dupes that need to be fixed!)

* Rename the content API project and namespaces

* Fixed bad merge

* Rename everything "Headless" to "ContentApi" or "Api"

* Refactor Content + Media: Key => Id, Name not nullable

* Make Content API property return value types independent of datatype configuration

* Clean up refactorings

* First stab at an expansion strategy using content picker as example implementation

* Use named JSON options for content API serialization

* Proper inclusion and registration of the content API

* Introduce API media builder

* Make MNTP return API content/media depending on configuration (instead of links) and support output expansion

* Content API: Get by controllers (#13740)

* Adding ContentApiControllerBase

* Adding get by id and url controllers

* Change route of get all test controller

* Rename to ContentApiController

* Refactoring

* Removing test controller

* Content API: Add start-node header value to deal with url collisions (#13746)

* Use start-node header value to deal with url collisions

* Cleanup

* Rename "url" param to "path"

* Adding a start node service to get the start-node header value

* Trim '/' from both beginning and end

* Content API: Support Accept-Language header (#13831)

* Move the content API JSON type resolver to an appropriate namespace

* Add localization based on Accept-Language header

* Content API: Output expansion  (#13848)

* Implement request based output expansion strategy + expansion output cache at property level

* Slighty leaner implementation for default output expansion strategy

* Clarify the code a bit

* Fix bad merge

* Encapsulate content API dependencies in the DI

* Support multi-site and multi-culture routing + a little rename/refactor (#13882)

* Support multi-site and multi-culture routing + a little rename/refactor

* Make the by route controller handle root nodes

* Rename Url to Path in API content output

* Add a few comments for magic route creation

* Rename services from "Default" to "Noop"

* Ensure that Umbraco can boot without adding "AddContentApi()" to ConfigureServices

* Moved incorrectly placed media builder

* Fix API routes (#13915)

* Fix multi URL picker value converter trying to access disposed objects in edge cases

* Delivery API: Content routing and structure (#13984)

* Introduce content route instead of content path, rename and rework start item (previously start node) handling

* Strip out start node path in generated route path

* Make the start-item header take precedence over the request domain

* Conditionally enabling the delivery API + add protection and preview support + refactor all services to be singletons + ensure no-op implementations for all required services (#13992)

* Include umbraco properties (width, height, ...) in the Media Properties collection (#14023)

* Move umbraco properties (width, height, ...) to the Properties collection of the API Media model

* Don't output the umbracoFile property of media items

* Add content type deny list (#14025)

* Create a deny list of content types and utilize it for output generation

* Add unit tests

* Dedicated property cache level for Content API (#14027)

* Support redirect tracking (#14033)

* Create a deny list of content types and utilize it for output generation

* Add unit tests

* Handle redirect tracking in the content API

* Include start item routing info for redirects

* Add cultures and their routes to the API output (#14038)

* Create a deny list of content types and utilize it for output generation

* Add unit tests

* Handle redirect tracking in the content API

* Include start item routing info for redirects

* Add culture routes to root output (for HREFLANG support)

* Rename redirect service method to better match its purpose

* Review changes

* Delivery API: Query controller (#14041)

* Initial commit

* Custom ContentAPIFieldDefinitionCollection

* Make index IUmbracoContentIndex

* Add querying for children by parent id (key)

* Add missing interface

* Adding querying endpoint

* Test code

* Compose unpublishedValueSet, so that you get the correct data in the ContentAPI index

* Renaming

* Fix ancestorKeys index values

* Adding IApiQueryExtensionService to be able to query the ContentAPI index in a generic way

* Fix IApiQueryService and clean up QueryContentApiController using it

* Support querying for path

* Fix content API indexing

* Fix default sorting

* Implement concrete QueryOption implementations

* Introduce new ExecuteQuery that uses the Core OptionHandlers

* Implement ExecuteQuery

* Change ExecuteQuery signature and implementation

* Implement demo sorting and fetching

* Add query option handlers and collection builder for them

* Cleanup

* Revert "Conditionally enabling the delivery API + add protection and preview support + refactor all services to be singletons + ensure no-op implementations for all required services (#13992)"

This reverts commit 78e1f748e55383baecd123d06457111e18f13365.

* Revert "Delivery API: Content routing and structure (#13984)"

This reverts commit a0292ae5350362dd6c1c5bc9763deda928c78a75.

* Revert "Fix multi URL picker value converter trying to access disposed objects in edge cases"

This reverts commit 6b7c37a5bf7871bee93a2b2640bbc6ef591f14db.

* Revert "Conditionally enabling the delivery API + add protection and preview support + refactor all services to be singletons + ensure no-op implementations for all required services (#13992)"

This reverts commit 78e1f748e55383baecd123d06457111e18f13365.

* Revert "Delivery API: Content routing and structure (#13984)"

This reverts commit a0292ae5350362dd6c1c5bc9763deda928c78a75.

* Revert "Fix multi URL picker value converter trying to access disposed objects in edge cases"

This reverts commit 6b7c37a5bf7871bee93a2b2640bbc6ef591f14db.

* Fix multi URL picker value converter trying to access disposed objects in edge cases

* Delivery API: Content routing and structure (#13984)

* Introduce content route instead of content path, rename and rework start item (previously start node) handling

* Strip out start node path in generated route path

* Make the start-item header take precedence over the request domain

* Conditionally enabling the delivery API + add protection and preview support + refactor all services to be singletons + ensure no-op implementations for all required services (#13992)

* Test commit

* Refactored interfaces for the query handlers and for the selectors (that will handle the value of the fetch query option)

* Implemented a base class for the query options

* Refactored the names of the selectors and made use of the base class

* Refactored the ApiQueryService

* Refactored the QueryContentApiController.cs

* Conditionally enabling the delivery API + add protection and preview support + refactor all services to be singletons + ensure no-op implementations for all required services (#13992)

* Fixing merge gone wrong

* Fix multi URL picker value converter trying to access disposed objects in edge cases

* Delivery API: Content routing and structure (#13984)

* Introduce content route instead of content path, rename and rework start item (previously start node) handling

* Strip out start node path in generated route path

* Make the start-item header take precedence over the request domain

* Conditionally enabling the delivery API + add protection and preview support + refactor all services to be singletons + ensure no-op implementations for all required services (#13992)

* Make fetching work with the new setup

* Moving files to dedicated folders

* Removing ? for array

* Rename selector query method

* Implement FilterHandler and some filters

* Implement SortHandler and sort some sorts

* Refactoring

* Adding more fields to index due to querying

* Appending filtering and sorting queries

* Implementing a new ISelectorHandler without Examine types

* Re-implementing the collection to have a dedicated one for the selectors

* Implementing a new IFilterHandler without Examine types & refactoring the filters implementing it

* Adding a new collection dedicated to filters

* Renaming the old collection

* Implementing a new ISortHandler without Examine types & refactoring the sorts implementing it

* Adding a new collection for the sorts & adding all collections to UmbracoBuilder.Collections

* Refactoring the service to use the new collections and types

* Refactoring the fields in ContentApiFieldDefinitionCollection

* Remove nullability in Handlers

* Don't return null for selector

* Add TODO for having the filters support negation

* Changing the SortType to FieldType with our custom types on the SortOption

* Fix AncestorsSelector

* Fix ApiQueryService

* Documentation

* Fix Swagger docs

* Refactor the QueryContentApiController

* Adding handling for the IApiContentResponse in the JsonTypeResolver

* Refactor the service to use a safe fallback value in Examine queries

* Adding Noop for the IApiQueryService

* Cleanup

* Remove comment

* Fix name field for indexing

* Don't inherit QueryOptionBase in filters

* Fix casing for API index constant + swap FIXME with TODO

* Add TODO for handling missing fetch with start-item header

* Rename query handler parameters to not leak source (i.e. query string)

---------

Co-authored-by: kjac <kja@umbraco.dk>
Co-authored-by: Elitsa <>
Co-authored-by: Zeegaan <nge@umbraco.dk>

* Delivery API: Adding pagination to query endpoint (#14083)

* Adding pagination to query endpoint

* Optimize the paging using Examine directly

* Fix comment

* Remove skip/take code duplication

---------

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

* Add missing CompatibilitySuppressions.xml

* Make Delivery API packable

* Make Api.Common packable

* Renamed extension method and namespace so it is discoverable

* Untangle ApiVersion configuration into api.common, so delivery api do not require the management api to boot.

* configure options in management api

* RTE output as JSON for Content API (#14067)

* Conditionally serve RTE output as JSON instead of HTML

* Fixed merge

* Rename to Delivery API (#14119)

* Rename ContentApi to DeliveryApi

* Rename delivery API index implementation

* Update comments from "Content API" to "Delivery API"

* Rename project from Content to Delivery

* Add dedicated controller base for content delivery API

* Rename delivery API content index to include "content" specifically

* Fix compat suppressions

---------

Co-authored-by: kjac <kja@umbraco.dk>
Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>
Co-authored-by: Zeegaan <nge@umbraco.dk>
2023-04-19 11:21:31 +02:00
Mole
21b0a7ffae New Backoffice: Fix feedback to users controller (#14031)
* Add specific not found results

* Add tests for the enable/disable not found tweak

* Cache ids and key in UserIdKeyResolver

* Don't cache null keys

* BackOffice not Backoffice

* Move fetching the user out of the ChangePasswordUsersController

* Move resolving user out of SetAvatar

* Move resolving user out of Update

* Return more specific notfound in bykey

* Use ErrorResult for all endpoints with unknown errors

* Split integration tests

* Add mappers

* Use ?: consistently

* Add reuseable iso code validator

* Validate ISO code

* Update supressions

* Use method from base to get current user key

* Rename ISo to Iso

* Use keys in services instead of user groups + Added a couple of new validations

---------

Co-authored-by: Bjarke Berg <mail@bergmania.dk>
2023-04-04 15:41:12 +02:00
Bjarke Berg
1f83e9ab19 Merge remote-tracking branch 'origin/v12/dev' into v13/dev 2023-03-29 11:08:53 +02:00
Bjarke Berg
61a33c734c Merge remote-tracking branch 'origin/v10/dev' into v11/dev
# Conflicts:
#	src/Umbraco.Core/Routing/UmbracoRequestPaths.cs
2023-03-29 10:30:16 +02:00
Mole
9b626d02c8 New backoffice: User controller (#13947)
* Add UserResponseModel

* Add factory to created UserResponseModel

* Add GetByKey controller

* Add GetAllUsers endpoint

* User proper response model

* Make naming consistent

* Order by username in GetAll

* Add user filter endpoint

* Fix includer user states

* Remove gravatar from the backend

* Send user avatars in response

* Add create user model

* start working on create

* Validate the create model

* Add authorization to create

* Use UserRepository instead of UserService to ValidateSessíonId

* Create IBackofficeUserStore interface

This is essentially a core-friendly version of the BackOfficeUserStore, additionally it contains basic methods for managing users, I.E. Get users, save users, create users, etc.

* Remove more usages of user service

* Remove usages of IUserService in BackofficeUserStore

* Add documentation

* Fix tests and DI

* add IBackOfficeUserStoreAccessor to resolve it in singleton services

* Resolve circular dependency

* Remove obsolete constructor

* Add core friendly user manager

* Finish createasync in user service

* Add WIP create endpoint

* Save newly creates users user groups

* Use service scope for user service

* Remove now unnecessary accessors

* Add response types

* Add update user endpoint

* Add EmailUserInviteSender

* Add technology free way of creating confirmation token

* Add invite uri provider

* Add invite user to user service

* Add invite user controller

* Add delete endpoint

* Add operation status responses

* Add operation status responses

* Added temporary file uploads including a repository implementation using local temp folder.

* Add Disable users endpoint

* missing files

* Fixed copy paste error

* Fix create users return type

* Updated OpenApi.json

* Updated OpenApi.json

* Handle if created failed in identity

* Add enable user

* Make users plural in enable/disable

We're doing the operation on multiple entities

* Added file extension check

* Add unlock user endpoint

* Clean up. Removed old TemporaryFileService and UploadFileService and updated dictionary items to use this new items

* Clean up

* Add reset password

* Add UpdateUserGroupsOnUsers method

* Add UpdateUserGroups

* Get rid of stream directly on TemporaryFileModel, and use delegate to open stream instead.

* Fix post merge

* Use keys instead of IDs

* Add ClearAvatar endpoint

* Review changes

* Moved models to their own files

* Reverted launch settings

* Move enlist extension to its own namespace

* Create set avatar endpoint

* Add reponse types

* Remove infrastructure extension after merge

* Add Cmapatibility suppressions

* Add test suppression

* Add integration tests

* Fix issue found in tests

* Add invited user to UserInvitationResult

* Add more tests

* Add update tests

* Hide different tests under parent

* Return DuplicatUserName user operation status if username matches an email

* Add update tests

* Change sorted set to HashSet

It doesn't work if it's not IComparable

* Change ID to Key when checking super

* Add get tests

* Add more GetAllTests

* Move tests to the right namespace

* Add filter test

* Fix including disabled users bug found by test

* Add test to ensure invited user state

* Add test case for UserState.All

* Add more filter tests

* Add enable disable tests

* Add resolver for keys and ids

* Replace usages of IUserService with IUserIdKeyResolver

* Add CompatibilitySuppressions

* Add UserIdKeyResolverTests

* Fix UserIdKeyResolver

* Add missing user operation results

* Updates from review

* ID not key

* Post instead of patch

* Use set instead of params for enable/disable

* Don't call to array

* Use sets for usergroup keys and user keys instead

* LanguageIsoCode instead of Language

* Update CompatibilitySuppressions after changin enumerable to set

---------

Co-authored-by: Bjarke Berg <mail@bergmania.dk>
Co-authored-by: kjac <kja@umbraco.dk>
2023-03-29 08:14:47 +02:00