Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Power Tools: Creating new Entity tied back to a user #7429


User avatar
0
tinytownsoftware created

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)
  • User Avatar
    0
    yekalkan created

    Can you explain a bit more?

    As i understand:

    1. You generated a new entity named "x", using power tools.
    2. Run the application and go to the new page.
    3. Create a new "x" on modal.
    4. want the new "x" to be visible to only the user who created it.

    Right?

  • User Avatar
    0
    tinytownsoftware created

    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?

  • User Avatar
    0
    yekalkan created

    You can make your entity derive from CreationAuditedEntity and use CreatorUserId property as a filter.