Editor or Creator of PageNode


(Florian Feuerpfeil) #1

Hi,

Is it possible to Save the user who created the PageNode? Something like:

properties:
  creator:
    type: references…
    defaultValue: the current user in the system
    editable: false
  createTime:
    type: datetime …
    defaultValue: the current timestamp

and or the same with the Editors of the document. I search for a method to set the current user by default.

Thanks

Florian


(Rene Rehme) #2

I would use Data Sources for that.

Maybe this service can help you to create your data: https://neos.github.io/neos/4.1/class-Neos.Neos.Domain.Service.UserService.html


(Aske Ertmann) #3

If it needs to be set automatically you can use the NodeAdded signal to set it as a property when a new node is created. Just check for the node type and call setProperty to the current user (use the user service to retrieve the current user). Alternatively you can use data sources to retrieve selectable options. You could even combine the two if you want it to be set automatically, but make it editable.

As for the creation time, that already exists in _creationDateTime (https://github.com/neos/neos-development-collection/blob/master/Neos.ContentRepository/Classes/Domain/Model/Node.php#L352)