Skip to content

Commit

Permalink
BUGFIX: Allow to insert node inside not editable content collection (…
Browse files Browse the repository at this point in the history
…via policy)

The `canEdit` check is evaluated by another privilege - the `EditNodePrivilege` - which is separate from the `CreateNodePrivilege` to allow or disallow node creation.

If `EditNodePrivilege` restricts almost all nodes except a few - say headline (by `nodeIsOfType`) - and `CreateNodePrivilege` does the same: only allow to create the headline (by `createdNodeIsOfType`), this policy is correctly enforced via the cr.
The Neos ui though is a little to restrictive and allows LESS than what is allowed by the core. The `EditNodePrivilege` would be required to be granted for content collections to be able to insert content.
To avoid having to grant this privilege - which comes with the burden of otherwise having to allow content collections AND its subtypes which could be sliders, and to be technically correct, we just dont evaluate the can edit here.

The button is still grey-d out if ALL nodes are disallowed by policy see: https://github.com/neos/neos-ui/blob/2597ffef66f7901569b865e35ea634a941b50a7b/packages/neos-ui-redux-store/src/CR/Nodes/selectors.ts#L292-L299

This behaviour has been since the introduction of Neos Ui policy evaluation: #1282

Though inside a commit shows that during the development the behavior was changed:

72b2614#diff-8b6869be808b6aad3e3ac19f6312c029d54112eb72aa09ffd757e4a7a686bcefR200

I can only assume that in "Enforce EditNodePrivilege for inline editing" the use of the `canEdit` flag was added to restrictive.
  • Loading branch information
mhsdesign committed Nov 13, 2024
1 parent a5b7015 commit 8e0a9db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/neos-ui-redux-store/src/CR/Nodes/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export const makeGetAllowedChildNodeTypesSelector = (nodeTypesRegistry: NodeType
(_: GlobalState, {role}: {reference: NodeContextPath | null, role: string, subject: NodeContextPath | null}) => role
],
(referenceNode, referenceParentNode, role) => {
if (referenceNode === null || (referenceNode.policy && referenceNode.policy.canEdit === false)) {
if (referenceNode === null) {
return [];
}
const isSubjectNodeAutocreated = referenceNode.isAutoCreated;
Expand Down

0 comments on commit 8e0a9db

Please sign in to comment.