Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace umbraco {
- public class requestHandler {
- public requestHandler(XmlDocument umbracoContent, String url) {
- ....
- // Check access
- HttpContext.Current.Trace.Write("umbracoRequestHandler", "Access checking started");
- if (currentPage != null) {
- if (
- Access.IsProtected(int.Parse(currentPage.Attributes.GetNamedItem("id").Value),
- currentPage.Attributes.GetNamedItem("path").Value)) {
- HttpContext.Current.Trace.Write("umbracoRequestHandler", "Page protected");
- /*
- * Super Ninja User Hack Start
- */
- // Make backend setting to enable super-ninja-user access, check that there is a backend user loged ind, check that the backend user is super-ninja-user from a user property
- if (true && umbraco.BusinessLogic.User.GetCurrent() != null && true)
- {
- // Check if backend user is part of ninja project
- if (!true)
- {
- HttpContext.Current.Trace.Write("umbracoRequestHandler",
- "Backend user not a ninja user - redirecting to login page...");
- currentPage =
- umbracoContent.GetElementById(
- Access.GetLoginPage(currentPage.Attributes.GetNamedItem("path").Value).ToString());
- }
- }
- /*
- * Super Ninja User Hack End
- */
- // Check normal user function
- else
- {
- if (System.Web.Security.Membership.GetUser() == null || !library.IsLoggedOn())
- {
- HttpContext.Current.Trace.Write("umbracoRequestHandler",
- "Not logged in - redirecting to login page...");
- currentPage =
- umbracoContent.GetElementById(
- Access.GetLoginPage(currentPage.Attributes.GetNamedItem("path").Value).ToString());
- }
- else
- {
- if (System.Web.Security.Membership.GetUser() != null &&
- !Access.HasAccces(int.Parse(currentPage.Attributes.GetNamedItem("id").Value),
- System.Web.Security.Membership.GetUser().ProviderUserKey))
- {
- HttpContext.Current.Trace.Write("umbracoRequestHandler",
- "Member has not access - redirecting to error page...");
- currentPage =
- content.Instance.XmlContent.GetElementById(
- Access.GetErrorPage(currentPage.Attributes.GetNamedItem("path").Value).ToString());
- }
- }
- }
- } else
- HttpContext.Current.Trace.Write("umbracoRequestHandler", "Page not protected");
- }
- HttpContext.Current.Trace.Write("umbracoRequestHandler", "Access checking ended");
- }
Advertisement
Add Comment
Please, Sign In to add comment