Activities of "lalitChougule"

  • ABP Framework version: v4.3.1
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no / yes
  • Exception message and stack trace: N.A
  • Steps to reproduce the issue:" N.A

Hi,

Our application is based on micro-service architecture.

In my application I have

  1. Gateway
  2. Identity Server
  3. Service 1
  4. Service 2
  5. Service 3

The solution is not implemented by abp.io Microservice template but it was implemented by your guidance and works as expected. Till now we had only one tenant but still multi tenancy was enabled in our application. Now we want to add few tenants to our system and facing below issues.

Issues :

  1. Migrations and seeding for new Tenant ( Separate database ), Seeding specially for Identity Server Client / Api Resource and all stuff.
  2. Connection string resolution.
  3. Common functionality to trigger migration / update-database for all projects present in application.

Each of the repository is custom repository https://docs.abp.io/en/abp/4.4/Repositories#custom-repository-interface I also tried to implement custom MultitenancyConnectionStringResolver. https://docs.abp.io/en/abp/4.4/Connection-Strings#replace-the-connection-string-resolver

My Questions :

  1. How to implement solution for above mentioned issues.
  2. Currently we created some Tenant database manually by running database script but want to automate this process.
  3. Seeding is also done manually by database script but want to automate this as well.
  4. When we run our application we get error's like Cannot connect to multiple dbContext etc. etc... Clearly connection string is not getting resolved. I need a way where I can log in log.txt file for each repository the connection string via which it is getting connected to the database. And want to make sure that it is connected to the expected database.

Please try to give deep explanation as the whole process is bit complex as we are not having the same template as abp.io microservice template

  • ABP Framework version: v4.3.1
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no / yes
  • Exception message and stack trace: N.A
  • Steps to reproduce the issue:" N.A

I have implemented override for SignInManager and have done some custom logic check in CanSignInAsync() method If my custom logic fails I thrown Exception ie. throw new AbpValidationException(...my_error_message...) On angular side I am not getting any error response in json format to handle, it's directly throwing the below error, below are the details from network tab.

Volo.Abp.Validation.AbpValidationException: Inactive user
   at SCV.Litmus.LitmusOverrides.LitmusSigInManager.CanSignInAsync(IdentityUser user) in D:\Litmus\Projects\ar-allocation\SCV.Litmus\aspnet-core\microservices\SCV.Litmus.IdentityServer\LitmusOverrides\LitmusSigInManager.cs:line 56
   at Microsoft.AspNetCore.Identity.SignInManager`1.PreSignInCheck(TUser user)
   at Microsoft.AspNetCore.Identity.SignInManager`1.CheckPasswordSignInAsync(TUser user, String password, Boolean lockoutOnFailure)

My expectation was something like this : https://docs.abp.io/en/abp/latest/Exception-Handling#validation-errors

{
  "error": {
    "code": "App:010046",
    "message": "Your request is not valid, please correct and try again!",
    "validationErrors": [{
      "message": "Username should be minimum length of 3.",
      "members": ["userName"]
    },
    {
      "message": "Password is required",
      "members": ["password"]
    }]
  }
}

How to get the above type of details by throwing error from SignInManager ?

Answer

Is there any answer for this question ?

Answer

@albert Please reply.

Answer

I was able to validate user credentitals using await _signInManager.CheckPasswordSignInAsync() Now I just want to know below things, This is angular login component code

login(params: LoginParams): Observable<any>; Which backend method is called when the above method is called from angular component ?

May be I can make a wrapper method and call this backend login method in my method once I done with my requirement.

import { Injector } from '@angular/core';
import { Params } from '@angular/router';
import { Observable } from 'rxjs';
import { LoginParams } from '../strategies/auth-flow.strategy';
import * as ɵngcc0 from '@angular/core';
export declare class AuthService {
    protected injector: Injector;
    private strategy;
    get isInternalAuth(): boolean;
    constructor(injector: Injector);
    init(): Promise<any>;
    logout(queryParams?: Params): Observable<any>;
    /**
     * @deprecated Use navigateToLogin method instead. To be deleted in v5.0
     */
    initLogin(): void;
    navigateToLogin(queryParams?: Params): void;
    login(params: LoginParams): Observable<any>;
    static ɵfac: ɵngcc0.ɵɵFactoryDef<AuthService, never>;
}
Question
  • ABP Framework version: v4.3.1
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Requirements

  1. When user enters the credentials I just want to validate the credentials, If it is valid I want to show few questionnaire
  2. Once all the questions are answered correctly then I want to actually create token

Current situation

  1. When user enter credentials token is generated. How do I stop this.
  2. Then I redirect user to questionnaire but the fact is user is already logged in. I want to avoid this.
  3. Post my questionnaire user is redirected to dashboard if answered correctly and logout if answers are wrong.

I hope you got my requirements clear. Please suggest me the easiest way to achieve this.

  • ABP Framework version: v4.3.1
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no / yes
  • Exception message and stack trace: N.A
  • Steps to reproduce the issue:" N.A

How to get selected language for a logged in user i.e. english, chinese etc. at application service level

"tr" "pt-BR" "en" "zh-Hans" "sl"

and where is it stored in db ? i.e.which table ?

Can you share a simple project?

No I can't.Sorry May be we can have a section and you can have a look into my project.

Can you share some steps and code to reproduce this? Thanks

I just check some permissions from IAuthorizationService and if not success I threw this error throw new AbpAuthorizationException("...");

Sorry for the delay

Hi,

Thanks for the example. I achieved my Login restriction requirement by Overriding SignInManager.CanSignInAsync();

But I am still stuck in the below issue Can you reply on this for roles : How I did for user can I do it for roles ? check below code I am not able to access individual record and update it added property. Once this is done we can close this ticket

public async Task<bool> MakeUserInactiveOnDormacyDaysCompletionAsync(Guid userId)
{
    try
    {
        var user = await _appUserRepository.GetAsync(userId);
        if (user != null)
        {
            user.Status = AbpUserStatusEnum.InActive;
            await _appUserRepository.UpdateAsync(user);
        }
        return true;
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
        return false;
    }
}
Showing 31 to 40 of 132 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 19, 2024, 10:13