Open Closed

Generate Permission Automatically from external service #5671


User avatar
0
oshabani created
  • ABP Framework version: v7.3.2
  • UI Type: MVC
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hi ,

we are using ABP now as Authentication and Authorization service (IAM or Auth-Server) , as we are attaching more and more services to this Auth-Server we need to generate permissions according to these services , so we need a mechanism to generate permission on start up for each service, save these permissions on Auth-Server.

is there anyway to do that , we already try to add these permissions to "abppermissions" table but it dose not work and Auth-server dose not list it on the permission list

advice plz


5 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Abp supports dynamic permissions, you can see this issue: https://github.com/abpframework/abp/pull/13644

    Other services will save permissions to the database at runtime.

    You need the following configuration in the auth server:

    Configure<PermissionManagementOptions>(options =>
    {
        options.IsDynamicPermissionStoreEnabled = true;
    });
    

    The auth server application will read the database at startup.

    There are some preconditions for using this function

    • You need to use Redis and use the same configuration(KeyPrefix).
  • User Avatar
    0
    oshabani created

    Hello,

    thanks for your answer, i already test it and it is not loading , i already added a permission to the database and re-start the auth-server but it is not showing in the permission list from Web-Application i am using Redis for sure

    regards,

    Osama

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Could you share the full steps to reproduce the problem?

    It's better if you can share a simple project that can reproduce the problem shiwei.liang@volosoft.com I will check it.

  • User Avatar
    0
    oshabani created

    it is simple, just create an MVC Tired solution with SQL entity framework ,

    then add any permission to the table AbpPermissions , and restart your application (web) and there are no permission in the list

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You should add a dynamic permission group and add sub-permissions to it.

    For example:

    For MVC Tired, the web project loads permissions from remote(HttpApi.Host).

    You need to empty the Redis cache(or restart the HttpApi.host project), wait for 30 seconds, and you will see the dynamic permissions.

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