hi
Which project are you adding the ELSA dashboard
to?
Similar questions: https://support.abp.io/QA/Questions/5733#answer-3a0db883-c466-1f48-be6b-ec834293db61
hi
What's your abp version? Are you using the latest lepton package?
Can you share an online URL? Include a test user. Thanks
liming.ma@volosoft.com
hi
This is normal behavior. Refreshing the page will solve the problem. The web project cannot always check whether the tenant exists.
hi
Is there a GivenName
claim?
https://github.com/abpframework/abp/blob/dev/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpUserClaimsFactory.cs#L91
You can add your custom AbpUserClaimsFactory
as well.
builder.Services.AddTransient<IUserClaimsPrincipalFactory<IdentityUser>, MyAbpUserClaimsFactory<IdentityUser>>();
ok, Please also share the steps to show the issue, thanks.
hi
I found a new discuss, You can take a look https://github.com/abpframework/abp/issues/4448
Dynamic permissions are suitable for distributed/microservice projects, and your situation is special. You'd better consider rewriting the above service custom code to solve it.
I will add code to the abp framework to fix this case.
hi
public class AddAbpRoleDataSeedContributor : IDataSeedContributor, ITransientDependency
{
private readonly IdentityUserManager _identityUserManager;
private readonly IdentityRoleManager _identityRoleManager;
private readonly IPermissionDataSeeder _permissionDataSeeder;
private readonly IFeatureChecker _featureChecker;
private readonly IFeatureManager _featureManager;
private readonly IPermissionDefinitionManager _permissionDefinitionManager;
private readonly ICurrentPrincipalAccessor _currentPrincipalAccessor;
private readonly ITenantRepository _tenantRepository;
public AddAbpRoleDataSeedContributor(IdentityUserManager identityUserManager, IdentityRoleManager identityRoleManager, IPermissionDataSeeder permissionDataSeeder, IFeatureChecker featureChecker, IPermissionDefinitionManager permissionDefinitionManager, IFeatureManager featureManager, ICurrentPrincipalAccessor currentPrincipalAccessor, ITenantRepository tenantRepository)
{
_identityUserManager = identityUserManager;
_identityRoleManager = identityRoleManager;
_permissionDataSeeder = permissionDataSeeder;
_featureChecker = featureChecker;
_permissionDefinitionManager = permissionDefinitionManager;
_featureManager = featureManager;
_currentPrincipalAccessor = currentPrincipalAccessor;
_tenantRepository = tenantRepository;
}
public async Task SeedAsync(DataSeedContext context)
{
if (context.TenantId.HasValue)
{
var tenant = await _tenantRepository.FindByIdAsync(context.TenantId.Value);
var myPrincipal = _currentPrincipalAccessor.Principal.Clone();
myPrincipal.Identities.First().AddClaim(new Claim(AbpClaimTypes.TenantId, tenant.Id.ToString()));
if (tenant.EditionId.HasValue)
{
myPrincipal.Identities.First().AddClaim(new Claim(AbpClaimTypes.EditionId, tenant.EditionId.ToString()));
}
using (_currentPrincipalAccessor.Change(_currentPrincipalAccessor.Principal))
{
var version = await _featureChecker.GetOrNullAsync(IdentityProFeature.EnableLdapLogin);
var version2 = await _featureManager.GetOrNullForTenantAsync(IdentityProFeature.EnableLdapLogin, context.TenantId.Value);
if(version == "V2")
{
//dosomething for V2
}
else
{
//dosomthing for V1
}
}
}
}
}
hi
Is there any info in the logs?
How can I reproduce this in my locally?
Thanks.