Skip to content

Conversation

@JamesAlias
Copy link
Contributor

What I did
Previous Behaviour:

  • When a view-only user clicks on a node on the preview page nothing happens.
  • The user can only select nodes via the content tree (left sidebar)
  • The user can not see any node data in the inspector (right sidebar)

Fixed Behaviour:

  • The user can interact with nodes on the preview page (highlighting is visible)
  • The user can view - but not edit - node data in the inspector (right sidebar)

How I did it

  • I let the backend send metadata to the client when the user has permission to read (previously it was only sent, when the user had permission to edit).
  • I handle the read-only case in CKEditor to prevent the user from editing and throwing errors that way.

This should also apply to read-only workspaces.

Note: When I tested editing content via circumventing browser behaviour (disabled fields etc) the server responded with an error. This has not been a very thorough test though.

How to verify it

  • Create a role (e.g. with the Sandstorm.NeosAcl package) that has permission to view but not to edit/create.
  • When browsing content the user should be able to click on nodes in the preview page and see their data in the inspector.

BEFORE
Screenshot before change
AFTER
Screenshot after change

** THIS HAS TO BE REVERTED BEFORE MERGE **

There is no tag for this dev branch in neos-ui-compiled. just use 8.4.
@JamesAlias JamesAlias force-pushed the task/add-ability-for-view_only-users-to-interact-with-preview-page-and-view-data-in-inspector branch from f5bf20d to f913346 Compare February 12, 2025 10:23
@JamesAlias JamesAlias self-assigned this Feb 12, 2025
"require": {
"neos/neos": "^8.3.0",
"neos/neos-ui-compiled": "self.version"
"neos/neos-ui-compiled": "8.4.x-dev"
Copy link
Contributor Author

@JamesAlias JamesAlias Feb 12, 2025

Choose a reason for hiding this comment

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

!!!Revert this before merging!!!

I had to do this to allow composer to install an existing neos/neos-ui-compiled version.

Copy link
Member

Choose a reason for hiding this comment

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

You could have probably also did this override from your root composer.json.
I don' remember having this issue.

Copy link
Member

Choose a reason for hiding this comment

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

☝️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will revert this right before merging

Copy link
Member

@skurfuerst skurfuerst left a comment

Choose a reason for hiding this comment

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

I really like this change; I reviewed this in depth.

IMHO, the functional change is a BUGFIX; so no need for a feature flag from my side.

Thanks <3

Copy link
Member

@Sebobo Sebobo left a comment

Choose a reason for hiding this comment

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

Thx for the change, this is useful!

Please look at my suggestion and solve the todos.

@JamesAlias JamesAlias requested a review from Sebobo February 17, 2025 09:51
@JamesAlias JamesAlias force-pushed the task/add-ability-for-view_only-users-to-interact-with-preview-page-and-view-data-in-inspector branch from bd02edc to 676d25b Compare February 17, 2025 11:48
@JamesAlias JamesAlias added the Bug Label to mark the change as bugfix label Feb 18, 2025
debouncedOnChange.flush();
return
}
editor.isReadOnly = isReadOnly;
Copy link
Member

Choose a reason for hiding this comment

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

i think i also attempted to use the IsReadOnly flag from ck and that did not work always correctly ... instead in #3842 i made it work by just NOT booting the ckeditor when there is no reason too and think we should do the same here? Not booting the ckeditor and still showing an outline or something is imo much more stable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see your point and feel free to implement this. For me personally I don't have the time and as long as it works like intended I will just keep it like this.

Copy link
Member

@Sebobo Sebobo left a comment

Choose a reason for hiding this comment

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

Works fine for me now.

Just noticed one editor that doesn't show a proper disabled state:
CleanShot 2025-02-25 at 08 43 28@2x

Not related to your change though.

Copy link
Member

@mhsdesign mhsdesign left a comment

Choose a reason for hiding this comment

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

Okay aside from the comment regarding the ckeditor thing i actually cant get this change to work:

The neos ui doesnt go in restricted editing mode and i can still edit things and get raw errors back

Access denied for method Method: Neos\ContentRepository\Domain\Model\Node::setProperty() Evaluated following 1 privilege target(s): "RestrictEditing": ABSTAIN (0 granted, 0 denied, 1 abstained) Authenticated roles: Neos.Flow:Everybody, Neos.Flow:AuthenticatedUser, Neos.Neos:Administrator, Neos.Neos:Editor, Neos.Neos:AbstractEditor, Neos.ContentRepository:Administrator, Neos.ContentRepository:InternalWorkspaceAccess, Neos.Neos:LivePublisher

this is the configuration i used

privilegeTargets:
  'Neos\ContentRepository\Security\Authorization\Privilege\Node\EditNodePrivilege':
    'RestrictEditing':
      matcher: 'isDescendantNodeOf("/sites/")'

  'Neos\ContentRepository\Security\Authorization\Privilege\Node\ReadNodePropertyPrivilege':
    'RestrictReading':
      matcher: 'isDescendantNodeOf("/sites/")'

roles:
  'Neos.Neos:Editor':
    privileges:
      -
        privilegeTarget: 'RestrictReading'
        permission: GRANT

*/
public function canReadNode(NodeInterface $node): bool
{
if (!isset(self::getUsedPrivilegeClassNames($this->objectManager)[ReadNodePropertyPrivilege::class])) {
Copy link
Member

Choose a reason for hiding this comment

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

The symbol ReadNodePropertyPrivilege was not imported and thus this is just a noop and returns always true

Copy link
Member

Choose a reason for hiding this comment

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

And when i import it i get a an exception

ReadNodePropertyPrivilege only support subjects of type PropertyAwareNodePrivilegeSubject or MethodPrivilegeSubject, but we got a subject of type: NodePrivilegeSubject

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We decided to use the ReadNodePrivilege, which actually exists.

Some Context: The user will not see a node he can not read, so this check is obsolete. We still keep it for AOP shenanigans though.

Copy link
Member

Choose a reason for hiding this comment

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

okay i will have to retest now as we use the ReadNodePrivilege now instead of ReadNodePropertyPrivilege

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mhsdesign I will merge this next week on Tuesday or Wednesday.
If you like, you can test this again.
Thank you for the reviews so far 😊

"require": {
"neos/neos": "^8.3.0",
"neos/neos-ui-compiled": "self.version"
"neos/neos-ui-compiled": "8.4.x-dev"
Copy link
Member

Choose a reason for hiding this comment

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

☝️

@JamesAlias JamesAlias requested a review from mhsdesign March 31, 2025 09:45
@markusguenther markusguenther moved this to Review Required 👀 in Neos 8.4 Release Board Jul 8, 2025
@Sebobo Sebobo moved this from Review Required 👀 to Nice to have - upmerge problem in Neos 8.4 Release Board Aug 21, 2025
@mhsdesign
Copy link
Member

Hi dear Robert.

We just dug out this one ;)

Sebastian and me just re-reviewed and retested this to evaluate if it can make it as a late candidate in to the 8.4 release.

In the demo i used this policy so no one can edit the blog page of the demo

privilegeTargets:
  'Neos\ContentRepository\Security\Authorization\Privilege\Node\EditNodePrivilege':
    'RestrictEditing':
      matcher: 'isDescendantNodeOf("/sites/neosdemo/node-iyyapnswso4eu")'

On a blog page

image

Typing also still continues to work in the inspector and yields raw errors.

Access denied for method Method: Neos\ContentRepository\Domain\Model\Node::setProperty() Evaluated following 1 privilege target(s): "RestrictEditing": ABSTAIN (0 granted, 0 denied, 1 abstained) Authenticated roles: Neos.Flow:Everybody, Neos.Flow:AuthenticatedUser, Neos.Neos:Editor, Neos.Neos:AbstractEditor, Neos.ContentRepository:Administrator, Neos.ContentRepository:InternalWorkspaceAccess, Neos.Neos:LivePublisher

Sebastian and me found a place to disable the editor in the InspectorEditorEnvelope::options() method by checking if node.policy.canEdit is false. This would disable the editors which is i think what this change wants to do?

image

Typing also still continues to work in CKEditor and yields raw errors and needs some love?.

Access denied for method Method: Neos\ContentRepository\Domain\Model\Node::setProperty() Evaluated following 1 privilege target(s): "RestrictEditing": ABSTAIN (0 granted, 0 denied, 1 abstained) Authenticated roles: Neos.Flow:Everybody, Neos.Flow:AuthenticatedUser, Neos.Neos:Editor, Neos.Neos:AbstractEditor, Neos.ContentRepository:Administrator, Neos.ContentRepository:InternalWorkspaceAccess, Neos.Neos:LivePublisher


So thank you for your contribution but as the current state seems not to be working as expected which would need additional work last minute and we would not feel comfortable introducing a change to the neos ui policies that close before the release. Please dont be discouraged!

@mhsdesign mhsdesign marked this pull request as draft October 7, 2025 08:03
@mhsdesign mhsdesign moved this from Nice to have - upmerge problem to In progress, but not this time ... in Neos 8.4 Release Board Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.4 Bug Label to mark the change as bugfix Task

Projects

No open projects
Status: In progress, but not this time ...

Development

Successfully merging this pull request may close these issues.

5 participants