Base solution for your next web application

Activities of "oprakash"

Hi There, I was trying to implement authorization in asp.net boiler plate. I followed below steps Database

  1. I added two new roles(Accounts, Sales) in "AbpRoles" Table.
  2. I added a user with Accounts roles in "AbpUserRoles".
  3. Also added some Permission in "AbpPermissions" table. Like -

Id Name IsGranted CreationTime CreatorUserId RoleId UserId Discriminator TenantId 119 Pages.Roles 1 59:59.9 2 4 Null Pages.Roles 1 120 Pages.Roles.Dashboard 1 59:59.9 2 4 Null Pages.Roles.Dashboard 1 121 Pages.Roles.Dashboard.ToDoList 1 59:59.9 2 4 Null Pages.Roles.Dashboard.ToDoList 1 122 Pages.Roles.Dashboard.Notifications 1 59:59.9 2 4 Null Pages.Roles.Dashboard.Notifications 1

Front end Code. 4. Added constant variable under "Code.Authorization.PermissionNames" as Below public const string Pages_Roles = "Pages.Roles"; public const string Pages_Roles_Dashboard = "Pages.Roles.Dashboard"; public const string Pages_Roles_Dashboard_ToDoList = "Pages.Roles.Dashboard.ToDoList"; public const string Pages_Roles_Dashboard_Notifications = "Pages.Roles.Dashboard.Notifications";

  1. Then I set permission in "Core.Authorization.ProjectNameAuthorizationProvider 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 Pages_Roles = users.CreateChildPermission(PermissionNames.Pages_Roles, L("Pages.Roles")); var Pages_Roles_Dashboard = Pages_Roles.CreateChildPermission(PermissionNames.Pages_Roles_Dashboard, L("Pages.Roles.Dashboard")); var Pages_Roles_Dashboard_ToDoList = Pages_Roles_Dashboard.CreateChildPermission(PermissionNames.Pages_Roles_Dashboard_ToDoList, L("Pages.Roles.Dashboard.ToDoList")); var Pages_Roles_Dashboard_Notifications = Pages_Roles_Dashboard.CreateChildPermission(PermissionNames.Pages_Roles_Dashboard_Notifications, L("Pages.Roles.Dashboard.Notifications"));

Result - Now when i log in by the user assigned this id (4-Account) the permissions are not granted to him.

Please Help me.

Thanks and Regards Om Prakash

Hi There, I am facing problem with implementing role base authorization in asp.net boilerplate. Tried the below steps. Database

  1. I introduced two new role(Accounts, Sales) to "abpRoles" table.
  2. Added two users with above roles in "AbpUserRoles".
  3. 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

Showing 1 to 2 of 2 entries