I want to “sense” that you are in backoffice and/or editmode. How do I do this?
Code:
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class B2BAuthorizationAttribute : AuthorizeAttribute
{
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
var isAuthenticated = httpContext.User.Identity.IsAuthenticated;
if (!isAuthenticated)
{
return false;
}
var personStorage = IoC.Resolve<PersonStorage>();
if (personStorage.CurrentSelectedOrganization != null || SecurityToken.CurrentSecurityToken.IsSystemUser)
{
return true;
}
var loginService = IoC.Resolve<LoginService>();
loginService.Logout();
return false;
}
}
Litium version: 7.3.2