Hi There, I am facing problem with implementing role base authorization in asp.net boilerplate. Tried the below steps. Database
- I introduced two new role(Accounts, Sales) to "abpRoles" table.
- Added two users with above roles in "AbpUserRoles".
- Added many roles to "AbpPermissions" table in respect of Accounts and Sales role.
Code, 4. I added constant string variable in "Core.Authorization.PermissionNames" class. 5. Then In "Core.Authorization.FinanceAuthorizationProvider:AuthorizationProvider " class i set the permission in "SetPermissions" method as below.
public override void SetPermissions(IPermissionDefinitionContext context) { //Common permissions var pages = context.GetPermissionOrNull(PermissionNames.Pages); if (pages == null) { pages = context.CreatePermission(PermissionNames.Pages, L("Pages")); } var users = pages.CreateChildPermission(PermissionNames.Pages_Users, L("Users")); var roles = pages.CreateChildPermission(PermissionNames.Pages_Roles, L("Roles")); }
-- Now when i log in with the users having Accounts, Sales Roles. Not able to get "Role" permission..
Please help.
Thanks and Regards Om Prakash
1 Answer(s)
-
0
Hi,
Can you share the data in [AbpPermissions] table and the TenantId of the user you are using to login ?
By the way, how do you grant permissions to roles in code ?