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

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)

Showing 1 to 2 of 2 entries