Base solution for your next web application

Activities of "sparta93"

I put the following inside my PermissionChecker.cs file and it worked -

        var user = userManager.GetUserByIdAsync(3).Result;

        //Grant user3 subscriber permissions to view dashboard pages
        var permissions = PermissionFinder
            .GetAllPermissions(new SEAAuthorizationProvider())
            .Where(n=>n.Name.ToString()=="Pages.Subscribers")
            .ToList();

         userManager.SetGrantedPermissionsAsync(user, permissions);

Also, I had to manually update some tables in the database. I probably have to create some functionality from the client side so assigning roles/permissions can be easier or is there a better way? thanks

Thank you. This is helpful.

I see now that I forgot to give the permission to the user.

Where would I ideally add those 2 lines? in which file? thank you

var user = await UserManager.GetUserByIdAsync(1); await UserManager.SetGrantedPermissionsAsync(user, grantedPermissions)

Hello, I recently discovered ASP.NET Boilerplate and it is a really amazing framework to get development started. I am trying to set up permissions for new menu items so that only the users can see certain pages and not the admins.

FYI I'm using the .NET CORE version of boilerplate.

I tried the following -

I first went to CORE\Authorization\PermissionNames.cs and added my new permission as the following:

public const string Pages_Subscriber = "Pages.Subscriber";

Then I went to CORE\Authorization\SEAAuthorizationProvider.cs and added the following:

   var subscribers = pages.CreateChildPermission(PermissionNames.Pages_Subscriber, L("Subscribers"));

Then in NavigationProvider.CS, I am adding the menu item like the following:

.AddItem( new MenuItemDefinition( "dashboard", L("dashboard"), url: "#", icon: "fa fa-home", requiredPermissionName: PermissionNames.Pages_Subscriber )

I'm still not seeing the menu item after logging into a user account I created, is there a step I'm missing. Any help will be appreciated, Thank you!

Showing 1 to 3 of 3 entries