The AlwaysAccessible attribute now can be added to controllers (not just to actions), fixes #4504

This commit is contained in:
Lombiq
2015-07-25 13:05:41 +02:00
parent 34be0b302f
commit 5420a038ba

View File

@@ -19,6 +19,10 @@ namespace Orchard.Security {
var accessFrontEnd = filterContext.ActionDescriptor.GetCustomAttributes(typeof (AlwaysAccessibleAttribute), true).Any();
if (!accessFrontEnd && filterContext.ActionDescriptor.ControllerDescriptor.ControllerType.GetCustomAttributes(typeof(AlwaysAccessibleAttribute), true).Any()) {
accessFrontEnd = true;
}
if (!AdminFilter.IsApplied(filterContext.RequestContext) && !accessFrontEnd && !_authorizer.Authorize(StandardPermissions.AccessFrontEnd)) {
filterContext.Result = new HttpUnauthorizedResult();
}