If i have five roles, every role has a different action how to give permissions for roles so which expression is best

if i have five roles, every role has a different action how give permissions for roles

Solved Solved
0 1 420
1 ACCEPTED SOLUTION

If you need roles beyond Admin and User, you will need to add app specific roles into your app.

The way I have done this is with a dedicated users table (e.g. Employees). The table would have columns for Role, Login Email and any other columns you wish - address, phone, personal email, etc.

The email allows you to link the logged in user to the correct row in your users table from which you can pull in the Role info.

Roles could be just an Enum column but I like to create a separate Roles table so changes can be made by an Admin right in the app without having to redeploy the app.

I hope this helps!

View solution in original post

1 REPLY 1

If you need roles beyond Admin and User, you will need to add app specific roles into your app.

The way I have done this is with a dedicated users table (e.g. Employees). The table would have columns for Role, Login Email and any other columns you wish - address, phone, personal email, etc.

The email allows you to link the logged in user to the correct row in your users table from which you can pull in the Role info.

Roles could be just an Enum column but I like to create a separate Roles table so changes can be made by an Admin right in the app without having to redeploy the app.

I hope this helps!

Top Labels in this Space