Open Closed

cross-tenant user profile picture is default #3240


User avatar
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);
        }
    }
 }
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

3 Answer(s)
  • User Avatar
    1
    maliming created
    Support Team Fullstack Developer

    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

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    sh_erfan created

    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);
        }
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Good news.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.