Open Closed

Modifiy identity entities. #4823


User avatar
0
akifakinci created

Hi. I use auth server. I want to modify users table or roles entity (table , dto). And I want to add "LicienceId property" CurrentUser objet How can I do it.

  • ABP Framework version: v7.1
  • UI type: Angular
  • DB provider: EF Core
  • *Tiered Identity Server Separated (Angular)
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

7 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    You can use the object extensions system to add a new property to table: https://docs.abp.io/en/abp/latest/Module-Entity-Extensions

    And I want to add "LicienceId property" CurrentUser objet

    You can add LicienceId to claims: https://docs.abp.io/en/abp/latest/Modules/OpenIddict#updating-claims-in-access_token-and-id_token https://docs.abp.io/en/abp/latest/Authorization#claims-principal-factory

    And add an extension method to currentuser:

    public static string LicienceId(this ICurrentUser currentUser)
    {
        return currentUser.FindClaim(“LicienceId”)?.Value;
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    fatihkaya created

    Hello again,

    First of all thanks for the answer, but when I use "object extensions system" to add a new property to the AbpUsers table, it adds this property as json data in the 'ExtraProperties' field, not as a new column. Is it possible to add it as a new column? Image: https://prnt.sc/WTi-Ib1DVvsV

    Another question, we want to add LicienceId as a claim (CurrentUser) but the project does not see the requested AbpClaimsServiceOptions class. We can't see LicienceId among the claims. Note: the code https://prnt.sc/TtLhg2aFaPUF

    Thanks for your help in advance

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

    Hi,

    First of all thanks for the answer, but when I use "object extensions system" to add a new property to the AbpUsers table, it adds this property as json data in the 'ExtraProperties' field, not as a new column. Is it possible to add it as a new column?

    Of course, you can check this: https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities#entity-extensions-ef-core

    Another question, we want to add LicienceId as a claim (CurrentUser) but the project does not see the requested AbpClaimsServiceOptions class. We can't see LicienceId among the claims.

    It's working for me.

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

    Alright. I created the field. How do I access Field? How do I get this value from the database when I log in? Is there a sign in handler? Isn't there a tidy document and example? In some documents it doesn't say where to add the code. I can't progress.

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

    Hi,

    See: https://docs.abp.io/en/abp/latest/Object-Extensions#getproperty

    var identity = context.ClaimsPrincipal.Identities.FirstOrDefault();
    var userId = identity?.FindUserId();
    if (userId.HasValue)
    {
        var userManager = context.ServiceProvider.GetRequiredService<IdentityUserManager>();
        var user = await userManager.GetByIdAsync(userId.Value);
        var licienceId = user.GetProperty<string>("LicienceId");
        ......
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    fatihkaya created

    Hi again,

    I want to debug login process. I want to make a developing while entering, so How can I debug Account/Login module? Account/Login is a Abp Module and How can I develop login process as custom?

    There is a CustomeSignInManager class in AuthServer project, Must I use it? İf there is a another way, I will be glad if you share with me.

    Thanks,

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

    Hi,

    I think this is a new topic, please open a new ticket thanks.

    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 23, 2026, 09:57
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.