mu-cl-resources
mu-cl-resources copied to clipboard
[feature request] automatically set created_by / modified_by
Similar (but I think less common than) #26 it would be useful if resources linked the creator and editor to the resource being updated or created. I think resources can derive the active user based on the session given that we always use a consistent model for session -> acount -> user, but not 100% sure.
Here as well this would be configurable based on a flag.
Another option that wouldn't require changes to this service is to add this behaviour in the frontend. In Kaleidos we do this by implementing an "abstract" model class that overrides the save()
behaviour to set the {created,modified}
and {created,modified}-by
values: https://github.com/kanselarij-vlaanderen/frontend-kaleidos/blob/development/app/models/model-with-modifier.js#L21-L24 (not the cleanest example as it does a bunch of other stuff, but just to share something that's already in use).
I wonder if it wouldn't be better/possible to add such a feature to mu-authorization instead. My main concern is that although automation via resources/the frontend is great, data is also created in services where that automation isn't going to be present. I imagine it'd be very easy to accidentally forget to set these fields in a service. If such a thing was instead handled at the base layer that all queries pass through, it could be added enabled for all cases.