Open Closed

Extending ICurrentUser and Auto Filtering #3196


User avatar
0
smutairi created
  • ABP Framework version: v5.3.0.RC3
  • UI type: Blazor WASM
  • DB provider: EF Core

I am using Azure AD to authenticate and I pull a custom claim "Country"

I want to use that custom claim all over the application, and I also want it to be used for AUTO Filtering Data at the Repository Level.

what are the best options to enable this requirement using ABP functionality and core extensibility


4 Answer(s)
  • User Avatar
    0
    gterdem created
    Support Team Senior .NET Developer

    To use Data Filtering, Country should be a property in your Entity. It should be an existing field to be queried on the database level.

    What will you use the custom claim against on the database? I suppose there is a corresponding field in an entity to check this field.

    Can you explain more about your intentions like how do you implement ICountry or how do you want to query?

  • User Avatar
    0
    smutairi created

    in the DB there is a list of ITEMS that have COUNTRY field.

    when a user authenticates with Azure AD I would like to pick up Country claim from their profile and auto filter the list of ITEMS based on the Country field matching the user profile.

    this functionality is currently what am looking for, it’s not implemented yet I am exploring the following:

    • Custom Claims
    • IdentityUser ExtraProperties
    • ICurrentUser
    • Custom Data Filters
  • User Avatar
    0
    gterdem created
    Support Team Senior .NET Developer

    It seems like a business logic with multiple ways to achieve it.

    You can add ICountry marker interface for Items and add a custom data filter checking if ICurrentUser has the country custom claim when the user logs in.

  • User Avatar
    0
    smutairi created

    ok thank you.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11