I am using the Power Tools extension to generate a new entity. I then went to the new page and created an entity. But to my surprise, this entity appeared for all users. I was expecting it to only be visible to the user who created it. So my question is, how exactly do I do this? What do I need to modify to add the foreign key to the user? The tool generated a lot of files, so it's a bit overwhelming. Thank you!
3 Answer(s)
-
0
Can you explain a bit more?
As i understand:
- You generated a new entity named "x", using power tools.
- Run the application and go to the new page.
- Create a new "x" on modal.
- want the new "x" to be visible to only the user who created it.
Right?
-
0
That is correct. Each user has its own collection of x'es. For example, todo items. If I create a todo item, I don't want it to be visible to other users.
It would be nice if there was a checkbox in the power tool to make this automatic, as I can see it being a common requirement. But for now, how and where do I add the dependency to the user in the various generated objects?
-
0
You can make your entity derive from CreationAuditedEntity and use CreatorUserId property as a filter.