Open Closed

How to implement a branch filter like imlutitenancy under a tenant #8423


User avatar
0
smansuri created
  • ABP Framework version: v8.2.1
  • UI Type: Angular / MVC
  • Database System: EF Core (MySQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): Auth Server Separated (for Angular)
  • Exception message and full stack trace:
  • Steps to reproduce the issue:
  • We are trying to store user info like which user has access to which all branches and each branch has what roles, ex: Branches : [{"Id":123, "Roles:['admin','user']},{"Id":113, "Roles:['subadmin','user']}] as object globally for filter purpose. Could you please suggest best way to integrate this in abp framework. storing this in access token looks incorrect as the information can have more arrays. We need to apply this filter with each db query like imultitenant filter. Filter is im clear how to implement.

14 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    We are trying to store user info like which user has access to which all branches and each branch has what roles,

    Have you implemented this?

    If you can get the object info you can easy to filter data based on it.

    https://abp.io/docs/latest/framework/infrastructure/data-filtering#defining-custom-filters https://abp.io/community/articles/switching-between-organization-units-i5tokpzt

  • User Avatar
    0
    smansuri created

    hi

    We are trying to store user info like which user has access to which all branches and each branch has what roles,

    Have you implemented this?

    If you can get the object info you can easy to filter data based on it.

    https://abp.io/docs/latest/framework/infrastructure/data-filtering#defining-custom-filters https://abp.io/community/articles/switching-between-organization-units-i5tokpzt

    Can i see all organization units data at once or it will be by organization unit only? Moreover i do no see organization units under newly created tenant.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can disable the filter to see all the data.

    https://abp.io/docs/latest/framework/infrastructure/data-filtering#idatafilter-service-enable-disable-data-filters

  • User Avatar
    0
    smansuri created

    hi

    You can disable the filter to see all the data.

    https://abp.io/docs/latest/framework/infrastructure/data-filtering#idatafilter-service-enable-disable-data-filters

    How can i maintain roles by organization units? moreover, I do not see organization unit for newly created tenant.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can add one or many members/roles to an organization unit

    See https://abp.io/modules/Volo.Identity.Pro

  • User Avatar
    0
    smansuri created

    hi

    You can add one or many members/roles to an organization unit

    See https://abp.io/modules/Volo.Identity.Pro

    I have a use case where i want to add roles by member for each organization unit and not maintain the role by organization unit. Moreover, if a member is belonging to branch USA and Turkey but USA branch has permission to view the book list but Turkey branch does not have permission to view the book list how does that scenario being handled here if i do not want to switch between the branch and display book list data at once if i disable the filter?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I have a use case where i want to add roles by member for each organization unit and not maintain the role by organization unit.

    In this case, you can use the organization manager to add roles. which means adding code to do this. The UI doesn't have this feature

    if a member is belonging to branch USA and Turkey but USA branch has permission to view the book list but Turkey branch does not have permission to view the book list how does that scenario being handled here if i do not want to switch between the branch and display book list data at once if i disable the filter?

    You can check the permission first and get the branch that has permission. then switch to this branch in the code to query the data.

  • User Avatar
    0
    smansuri created

    hi

    I have a use case where i want to add roles by member for each organization unit and not maintain the role by organization unit.

    In this case, you can use the organization manager to add roles. which means adding code to do this. The UI doesn't have this feature

    if a member is belonging to branch USA and Turkey but USA branch has permission to view the book list but Turkey branch does not have permission to view the book list how does that scenario being handled here if i do not want to switch between the branch and display book list data at once if i disable the filter?

    You can check the permission first and get the branch that has permission. then switch to this branch in the code to query the data.

    I get that. it becomes complicated in case i have 3 branch where in user have permission in 2 branches USA and turkey but not in the third branch let's say UK. Any suggestion to handle this?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    1. You can query three times and combine the results. get all branches of current user, switch and query.
    2. You can add your EF Core query instead of using datafilter.
  • User Avatar
    0
    smansuri created

    hi

    1. You can query three times and combine the results. get all branches of current user, switch and query.
    2. You can add your EF Core query instead of using datafilter.

    Can you suggest the best way to store the object similar to this : Branches : [{"Id":123, "Roles:['admin','user']},{"Id":113, "Roles:['subadmin','user']}]

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can create a new Entity/Table to store these Branches of a user.

    | Id | Roles | Foreign Key (userid) | | --- | ------------------- | -------------------- | | 1 | ['admin', 'user'] | 123123123 |

  • User Avatar
    0
    smansuri created

    hi

    You can create a new Entity/Table to store these Branches of a user.

    | Id | Roles | Foreign Key (userid) | | --- | ------------------- | -------------------- | | 1 | ['admin', 'user'] | 123123123 |

    No i Was asking how to store it as cache so that we can use without db call.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    See the document https://abp.io/docs/latest/framework/fundamentals/caching

    The cache key can be user id.

  • User Avatar
    0
    alper created
    Support Team Director

    The ticket is reopened. You can write again @Safwan...

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09