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

Activities of "meff"

Hello. First of all - thank you for your great work. ABP is awesome.

On already working ABP (AngularJS + EF) application I need to implement functionality where admin user of one tenant can act as any user of another tenant.

In order to replace IAbpSession.TenantId I have derived ClaimsAbpSession, registered it in module:

public class MyAbpSession : ClaimsAbpSession
{
  public MyAbpSession(IMultiTenancyConfig multiTenancy) : base(multiTenancy) {}
  private int? _tenantId;
  public int? SetCurrentTenantId
        {
            set { this._tenantId = value; }
        }
        public override int? TenantId
        {
            get
            {
                var claimsPrincipal = Thread.CurrentPrincipal as ClaimsPrincipal;
                if (claimsPrincipal == null)
                    return null;
                return this._tenantId ?? base.TenantId;
            }
        }  
}

But I still have MayHaveTenant filter problem. Is there any chance I could globally set filter parameter for all UnitsOfWork?

_unitOfWorkManager.AllUnitsOfWork.SetFilterParameter(AbpDataFilters.MayHaveTenant, AbpDataFilters.Parameters.TenantId, input.TenantId.Value);

And this has to be done from Impersonation method (any ApplicationService or AccountController in .Web), not from module initialization.

I can not disable AbpDataFilters.MayHaveTenant / AbpDataFilters.MustHaveTenant globally, because impersonator must see only data of Tenant, that she is impersonating.

What I have tried:

  1. To derive from EfUnitOfWork and override ApplyFilterParameterValue, but I could not inject MyEfUnitOfWork :-(
  2. Wanted to derive from class UnitOfWorkManager, but it is Internal, so no luck.

What would be the best solution to achieve my business requirement?

I am even thinking of creating identical AbpUsers (and synchronizing for password change and so on) for each tenant, that a user must have access to... Is ASP.NETZERO has fully implemented impersonation (on features it says "User and Tenant impersonation")?

Could you please provide some advise to this problem? Thank you in advance.

Showing 11 to 11 of 11 entries