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

How would I approach adding an entity that's keyed to a tenant, but give tenant limited access? #10915


User avatar
0
marble68 created

Rather than put the entity at the tenant level, we want to edit a tenants departments at the host level.

If I use the radtool - the Tenant isn't available as a navigation property.

We would like to search across tenants and all departments for a specific department sometimes, whie logged in as host.

In addition, we don't want the tenant being able to add or remove departments.

Would it be better to add this to the tenant and host, then define a role for the tenant so they have no access to departments?

Not sure of the best approach. Any advice is appreciated.


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @marble68

    If I understand this correctly, you should define your entity on Host side as a non multi tenant entity. You can manually add a relation to Tenant wihtout using the Power Tools.

  • User Avatar
    0
    marble68 created

    ok - Ill experiment with that.

    thank you

  • User Avatar
    0
    marble68 created

    Do you have an example of manually adding the relation to a Tenant I could look at?

    Do I just put the nullable TenantId on the model, then modify the getall to include the current TenantId to ensure each tenant is only returned associated entities?

    Thanks

  • User Avatar
    0
    musa.demir created

    Hi @marble68

    Since it is not inherits IMayHaveTenant or IMustHaveTenant you should filter it by tenant yourself. Like:

    var list= _myEntity.GetAll().Where(x=>x.TenantId == input.TenantId).Tolist()
    

    Since I don't know your structure, I shared a sample code. If you have difficulty in writing the query, if you share the entity and other related code parts and the query you want to write, I can help you in more detail.

  • User Avatar
    0
    marble68 created

    This is what I'm doing now - Ok, great - but I need to add that TenantId to the DTOs and Entity as well I guess; unless I specify it in the rad tool.

    ok, Thanks.