Open Closed

Access of multi-tenant transaction data #10593


0
samir.edm created

Hello,

This is about the ASP.NET Zero subscription that we recently purchased, and understanding the host-tenant architecture that it offers. We are using Angular as peoduct type with .net core.

We are working on a multi-tenanted system and have a use-case, where the users of type "Customer Support Representatives" (CSR) will need access to the transaction data of multiple tenants. Currently as we understand your framework, the tenant data is accessible to the tenant users only. So we want to know how to make tenant's data accessible to all the CSRs without creating separate user accounts for each tenant.

In addition to the CSRs, we also have other types of users from the Operations department that will need similar access to tenant's transactions.

And all this we want to achieve without breaking the integrity of ASP.NET Zero framework, while keeping the user experience convenient.

So we would like to talk to someone from your side, and get a better understanding of your framework. We have offices in the USA and India and our hours are pretty flexible to accommodate a conference call with you. Please advise. 

Thanks


6 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi @samir.edm

    You can disable multi tenancy filter as explained here https://aspnetboilerplate.com/Pages/Documents/Data-Filters#disable-filters and access the all tenants data. But, this approach will work only if you are storing all tenant's data in the same database. If you are using a separate database for some or all of the tenants, it will not work. Please let me know if you are using such an approach.

  • 0
    samir.edm created

    Hello,

    We are not using separate databases for tenants. We are able to access the data as mentioned.We are looking for the solution where Users have overall access to the all the tenant and its entities(transactions under each tenant), can Add/Update/Disable almost anything in the Platform.

    Thanks.

  • 0
    samir.edm created

    Hello @ismcagdas

    Hello,
    
    We are not using separate databases for tenants. We are able to access the data as mentioned.We are looking for the solution where Users have overall access to the all the tenant and its entities(transactions under each tenant), can Add/Update/Disable almost anything in the Platform.
    
    Thanks.
    

    Can you please help me with the above scenario? We need to know if it is feasible of not in ASP Net Zero.

    Thanks

  • 0
    musa.demir created
    Support Team

    Hi @samir.edm

    The main purpose of multitenant systems is to separate data from each other. AspNet Zero does this very securely. However, there is no setting to authorize a user to access all data. There are several reasons for this. One of them is that this data can be kept in other databases on a tenant basis, and when you make any query, you need to do it in the database of that tenant. In such a case, hundreds of different databases may need to be requested to pull a data, and this can cause huge performance problems.This is one of the reasons other than security issues. If your user needs to get data from all tenants(or needs to do any other db operations), you can pull this data with the method @ismcagdas said. If the your tenants has seperate connection strings, you can also use something like:

    private readonly IRepository<Tenant> _tenantRepository;
     //...
    var allMyItems = new List<MyEntity>();
    var tenants = _tenantRepository.GetAllList(t => t.ConnectionString != null && t.ConnectionString != "");
    
    foreach (var tenant in tenants)
    {
        using (AbpSession.Use(tenant.Id,null))
        {
            using (_unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant))
            {
                //TODO: do your query here
                //var items =  _myEntityRepository.GetAllList();
                //allMyItems.AddRange(items);
            }
        }
    }
    
  • 0
    samir.edm created

    Hello @musa.demir,

    We are nto going to use multiple DB. We have single DB implementation. I pulled the required data using the methods @ismcagdas mentioned. But this method does not allow the defined operations to be performed on the data.

    As you mentioned "there is no setting to authorize a user to access all data", Is there better way to implement this? We would like to talk to someone from your side, and get a better understanding of your framework. We have offices in the USA and India and our hours are pretty flexible to accommodate a conference call with you. Please advise.

    Thanks

  • 0
    ismcagdas created
    Support Team

    Hi @samir.edm

    Sorry for our late reply. If you want all users to access all tenant data, maybe you shouldn't mark your entity as multi tenant. Instead, you can just add TenantId field (not inherit from IMayHaveTenant and IMustHaveTenant). In that way, all users can access to those data and make requested operations. Does that sound good for you ?