Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] automatically set created_by / modified_by #27

Open
nvdk opened this issue Jan 23, 2023 · 1 comment
Open

[feature request] automatically set created_by / modified_by #27

nvdk opened this issue Jan 23, 2023 · 1 comment

Comments

@nvdk
Copy link
Member

nvdk commented Jan 23, 2023

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.

@sergiofenoll
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants