Skip to content

feat: ask the resource type for the access of an actor - #66612

Draft
susnux wants to merge 2 commits into
feat/resource-permissionsfrom
feat/resource-permissions-access
Draft

susnux wants to merge 2 commits into
feat/resource-permissionsfrom
feat/resource-permissions-access

Conversation

@susnux

@susnux susnux commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Resource types now return the ways an actor has access to their resources. A check without access entries asks the resource type instead of allowing all permissions of the type, so callers no longer have to intersect the result with the access they grant. An empty list of entries means no access.

The use case is also to later make it easy to plugin unified sharing for resolving access.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Resource types now return the ways an actor has access to their resources.
A check without access entries asks the resource type instead of allowing
all permissions of the type, so callers no longer have to intersect the
result with the access they grant. An empty list of entries means no access.

Assisted-by: ClaudeCode:claude-fable-5-2
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux added this to the Nextcloud 36 milestone Nov 14, 2026
@susnux
susnux requested a review from salmart-dev November 14, 2026 08:27
@susnux
susnux added this pull request to stack #66613 November 14, 2026 08:27
@susnux susnux added enhancement 3. to review Waiting for reviews labels Nov 14, 2026
`NCU\Resource\Permission\IAccessManager` returns the access an actor was
given to resources before any restriction, so apps do not have to ask the
resource types themselves.

Assisted-by: ClaudeCode:claude-fable-5-2
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@salmart-dev

Copy link
Copy Markdown
Contributor

This change is very problematic as it would completely undo all the performance improvements we did in the last year, since it would require resource providers to always resolve access origin for resources, which for files requires retrieving shares and mount information from all apps.

I think we need to support providing cached/aggregated permissions initially and avoid at all costs this expensive eager-loading. The only reason why it is currently required is because of the Restriction::forRecipient implementation to allow the "Circles" app to restrict permissions on a resource based on a Membership and a Role.

@susnux

susnux commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

I think we need to support providing cached/aggregated permissions initially and avoid at all costs this expensive eager-loading.

That is already covered for exactly that reason:
https://github.com/nextcloud/server/pull/66612/changes#diff-f1d0db3897100c6ea0bf5c0b30524aa37321f0af548ba464bb336ac1d086d45dR63

You can pass cached permissions as the entries option.

The only reason why it is currently required is because of the Restriction::forRecipient implementation to allow the "Circles" app to restrict permissions on a resource based on a Membership and a Role.

No its also to hook in unified sharing. Thats even the main idea:
Apps that only use unified sharing do not need to have any permission logic anymore as this is automatically solved then by the unified sharing integration.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants