Activities of "willignicolas@gmail.com"

Answer

Hello,

Thanks for your great work Abp team.

We have migrate from 4.3 to 5.0 and see a big style difference on button light.

It's a normal change? The background is now gray and not changing on mouse over.

On 4.3 :

.btn-light {
    color: [#212529](https://support.abp.io/QA/Questions/212529);
    background-color: #f8f9fa;
    border-color: #f8f9fa;
}

On 5.0

.btn-light {
    color: #000;
    background-color: #eee;
    border-color: #eee;
    box-shadow: 0px 0px 30px rgb(8 20 73 / 10%);
}

We can see an evolution on radio and checkbox too

4.3

5.0

Lepton presentation website is ok (same as 4.3)

Thanks for your help

Nicolas

Hello and thanks for your help.

I was not able to make your code working (BTW the last edition of your post doesn't change the value of the claim so i don't anderstand how it work)

There is the code that works (inspired by your first editon of your last post) :

My application service :

[Authorize]
    public class ConfigurationAppService : JureezAppService, IConfigurationAppService
    {
        private readonly ICurrentPrincipalAccessor _currentPrincipalAccessor;
        private readonly VAI.IIdentityUserRepository _userRepository;
        private readonly SignInManager<VAI.IdentityUser> _signInManager;


        public ConfigurationAppService(ICurrentPrincipalAccessor currentPrincipalAccessor,
            VAI.IIdentityUserRepository userRepository,
            SignInManager<VAI.IdentityUser> signInManager)
        {
            _currentPrincipalAccessor = currentPrincipalAccessor;
            _userRepository = userRepository;
            _signInManager = signInManager;
        }

        public virtual ShowPopupsOutputDto GetShowedPopups()
        {
            var welcomePopupClaim = _currentPrincipalAccessor.Principal.Identities.First().FindFirst(ClaimsConst.WelcomePopupShowedClaimName);

            return new ShowPopupsOutputDto
            {
                ShowWelcomeConfigPopup = welcomePopupClaim == null || welcomePopupClaim.Value == "false",
            };
        }

        public virtual async Task SetShowedWelcomePopup()
        {
            var user = await _userRepository.FindAsync(CurrentUser.GetId());

            await _signInManager.SignOutAsync();
            await _signInManager.SignInWithClaimsAsync(user, true, new List<Claim> { new Claim(ClaimsConst.WelcomePopupShowedClaimName, "true") });
        }

    }

No claimprincipalcontributor only the claim declaration in my module :

Configure<AbpClaimsServiceOptions>(options =>
            {
                options.RequestedClaims.Add(ClaimsConst.WelcomePopupShowedClaimName);
            });

With this solution my claim value is truly updated and available on the read method for the rest of my user session.

Thanks again for your time and your help.

Nicolas

Thanks for your quick reply.

I have tested your solution but the result stay the same.

On the end of the write method the CurrentUser.GetAllClaims() (or on the currentPrincipalAccessor.principal) have the claim with the new value ("true") but when i call the read method again the value is "false".

There is my full code of appservice :

public virtual ShowPopupsOutputDto GetShowedPopups()
        {
            var welcomePopupClaim = _currentPrincipalAccessor.Principal.Identities.First().FindFirst(ClaimsConst.WelcomePopupShowedClaimName);

            var test = CurrentUser.GetAllClaims();
            return new ShowPopupsOutputDto
            {
                ShowWelcomeConfigPopup = welcomePopupClaim == null || welcomePopupClaim.Value == "false",
            };

        }

        public virtual async Task SetShowedWelcomePopup()
        {
            var claimsIdentity = _currentPrincipalAccessor.Principal.Identities.First();

            claimsIdentity.AddOrReplace(new Claim(ClaimsConst.WelcomePopupShowedClaimName, "true"));

            using (_currentPrincipalAccessor.Change(_currentPrincipalAccessor.Principal))
            {
                await _httpContextAccessor.HttpContext.SignOutAsync();
                await _httpContextAccessor.HttpContext.SignInAsync(_currentPrincipalAccessor.Principal);
            }
            
            
        }

And the contributor :

  public class JureezClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
    {
        public async Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
        {
            var currentTenant = context.ServiceProvider.GetRequiredService<ICurrentTenant>();

            var claimsIdentity = new ClaimsIdentity();
            context.ClaimsPrincipal.Identities.First().AddClaim(new Claim(ClaimsConst.WelcomePopupShowedClaimName, currentTenant.Id != null ? "false" : "true")); ;
        }
    }

Thanks again for your help.

Nicolas.

  • ABP Framework version: v4.3.0
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

Hello,

We want to show a popup to users only one time for a user session so we go for user claims.

We make a ClaimsPrincipalContributor and the creation process of the new claim work perfectly.

We have a applicationservice's method to get the claim value from icurrentuser or currentprincipalaccessor to know if we must or not show the popup.

Our read method use : _currentPrincipalAccessor.Principal.Identities.First().FindFirst(ClaimsConst.WelcomePopupShowedClaimName);

But when it is time to update the value of the claim when the popup has been displayed to the user we fail to get good results despite our many attempts.

For exemple if we do this code the claim seems to update but on the read method the claim still have "false" value

var claimsIdentity = _currentPrincipalAccessor.Principal.Identities.First();

claimsIdentity.AddOrReplace(new Claim(ClaimsConst.WelcomePopupShowedClaimName, "true"));

await _httpContextAccessor.HttpContext.SignOutAsync();
await _httpContextAccessor.HttpContext.SignInAsync(_currentPrincipalAccessor.Principal);

And so here is our question: How to update an existing user claim (on the call of a applicationservice's method) when the user is connected ?

Thanks for you help.

Nicolas

Hi Alper,

It's ok for us too.

Thanks for your help and the solution.

sended to info@abp.io

Many thanks for your help.

I can do that but you must have the database too. Because it works with a New db. How can we send you our mssql db ? (a Light version that have the problem too)

Same here we use exclusively one shared database.

Thanks Alper to have take time to read the logs.

I don't anderstand when to add a new connection string in my db? I can add it after the tenant creation but it's too late because the user will not be created on the tenant creation and the problem will still remain. I can add it before the tenant creation but I have not the Id at this moment.

Sorry if this a dumb question and i have not anderstand your advised manipulation.

One more information it's that with a completly new db in my existing migrated app when i create a new tenant the user is created with success and the SaasTenantConnectionStrings is empty.

Hello Alper,

There is the situation. I have a few days ago pass to 4.3 (without making the migration with compare files method) launch the DBMigrator and see the tenant creation problem in production.

Then I have make the full migration with compare files, restart DBMigrator and still have the problem.

The Handler is in place and the error in the log is from the handler file.

More informations : Tenant creation is OK with new project and with our project but a new database so is something in our database.

Many thanks for your help.

The error log on tenant creation (we transfer link because is too long for the post permission) https://we.tl/t-BLS8bFoK4s

Showing 11 to 20 of 35 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11