Skip to content

Elements: Align ElementPermissionService for performance improvements#22405

Merged
kjac merged 5 commits intov18/devfrom
v18/task/align-performance-improvements-with-elements
Apr 10, 2026
Merged

Elements: Align ElementPermissionService for performance improvements#22405
kjac merged 5 commits intov18/devfrom
v18/task/align-performance-improvements-with-elements

Conversation

@kjac
Copy link
Copy Markdown
Contributor

@kjac kjac commented Apr 10, 2026

Prerequisites

  • I have added steps to test this contribution in the description below

Description

This PR mirrors the (relevant) ContentPermissionService performance improvements from #21470 to the ElementPermissionService.

Specifically, the use of IEntityService.GetAllPaths() when authorizing for specific keys.

Since the ElementPermissionService is concerned with both containers and element, new overloads for IEntityService.GetAllPaths() and IEntityRepository.GetAllPaths() have been introduced, allowing for fetching the paths of multiple object types in one query.

Testing this PR

Verify that element permissions still work - for example, remove element delete permissions for the admin user group and verify that element deletion is no longer possible (note: the UI still permits the action, but the API should respond in kind with a 403).

Copy link
Copy Markdown
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good apart from some code that was previously there that I think you need to remove to realise the performance benefit. I'll give it a test now.

Comment thread src/Umbraco.Core/Services/ElementPermissionService.cs Outdated
Comment thread src/Umbraco.Core/Persistence/Repositories/IEntityRepository.cs Outdated
Comment thread src/Umbraco.Core/Services/ElementPermissionService.cs
kjac and others added 3 commits April 10, 2026 12:53
Co-authored-by: Andy Butland <abutland73@gmail.com>
…vements-with-elements' into v18/task/align-performance-improvements-with-elements
Copy link
Copy Markdown
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests out as expected, so please feel free to merge once you've decided on where to go with the unit tests suggestion.

@kjac kjac enabled auto-merge (squash) April 10, 2026 11:55
@kjac kjac merged commit 010ceab into v18/dev Apr 10, 2026
26 of 27 checks passed
@kjac kjac deleted the v18/task/align-performance-improvements-with-elements branch April 10, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants