0
sh_erfan created
- ABP Framework version: 5.2
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
- Steps to reproduce the issue:"
- Create new project,
- Override GetProfilePictureFile method of IAccountAppService in identity server project
- Disable MultiTenant to get profile picture of user from another tenant
This is what I have done, but still getting default profile image
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IAccountAppService), typeof(AccountAppService),
typeof(MyAccountAppService))]
public class MyAccountAppService : AccountAppService
{
public RecruitansAccountAppService(
IdentityUserManager userManager,
IAccountEmailer accountEmailer,
IAccountPhoneService phoneService,
IIdentityRoleRepository roleRepository,
IdentitySecurityLogManager identitySecurityLogManager,
IBlobContainer accountProfilePictureContainer,
ISettingManager settingManager,
IOptions identityOptions,
IIdentitySecurityLogRepository securityLogRepository)
: base(userManager, accountEmailer, phoneService, roleRepository, identitySecurityLogManager,
accountProfilePictureContainer, settingManager, identityOptions, securityLogRepository)
{
}
public override async Task<IRemoteStreamContent> GetProfilePictureFileAsync(Guid id)
{
using (DataFilter.Disable<IMultiTenant>())
{
return await base.GetProfilePictureFileAsync(id);
}
}
}
3 Answer(s)
-
1
Disable MultiTenant to get profile picture of user from another tenant
hi
You can change the tenant instead of disabling it.
https://docs.abp.io/en/abp/latest/Multi-Tenancy#change-the-current-tenant
-
0
Thanks This solved the problem
public override async Task<IRemoteStreamContent> GetProfilePictureFileAsync(Guid id) { Guid? targetTenantId = null; using (DataFilter.Disable<IMultiTenant>()) { var user = await UserRepository.FindAsync(id); targetTenantId = user.TenantId; } using (CurrentTenant.Change(targetTenantId)) { return await base.GetProfilePictureFileAsync(id); } }
-
0
Good news.