Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Roles and Permissions help #4086


User avatar
0
strix20 created

I've read through as much of the ABP and Zero documentation regarding roles, permissions, and authorizations as I could find, but I'm still having trouble understanding how to go about configuring static roles.

The standard static roles are Admin (which has all permissions), and User (which has no permissions.)

For our application, we will have several static roles, in addition to the dynamic roles. These static roles will have permissions associated with them by default.

I know how to add permissions to a user, but how are we supposed to associate permissions with static roles so that when that role is assigned to a user, they are granted the appropriate permissions?


3 Answer(s)
  • User Avatar
    0
    alirizaadiyahsi created

    Dynamic roles and static roles have exactly the same functionality. Static roles are hard-coded created but they are managing like dynamic roles (can not deleted from UI).

    If they are granted the permissions and they are assigned to a user, then user will have all permissions that are granted to these static roles. (same as dynamic roles)

  • User Avatar
    0
    strix20 created

    I understand that, what I haven't figured out is how to associate permissions with the roles so that when the role is assigned, the permissions is granted, WITHOUT logging in to the application and configuring the role from the back end.

    From what I can tell, all permissions are stored at the user level, and assigning a role simply applies the associated permissions.

    From the code I found, it's very basic: admin grants all permissions, user grants no permissions.

    The permission manager can grant an individual user permissions, but I need to be able to establish preconfigured roles, and seed them accordingly. This should happen through migrations, not a configuration step or while the application is running.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @strix20,

    What you are looking for is not implemented by default. You can create another class to store (maybe a static list in the code) static role - permissions mappings. Then you can assign related permissions to a static role, when a static role is created for the new Tenant.