So i have a requirement where i created 2 roles from Admin panel in CMS and then to each page of my site im assigning them the rights and role in the Visible to property on the top.
Now in my MVC code i want to fetch the role and the access rights given to that page based on which i will let the user see the page or redirect them to login. My user does not exists in Episerver as im using another mode of login in the application . Im redirected back to my application after login from 3rd party app which calls my Authorization filter in which i want to check the requested page roles and rights assigned to it.
I tried QueryAccess method after going through some post but it just tells me the read and write access but not the role name.
You can retrieve the assigned roles and permissions for a given page from the ACL property of the page like this:
foreach (var entry in currentPage.ACL.Entries)
if (entry.Name == "Administrators" && entry.Access != AccessLevel.FullAccess)