mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
The AlwaysAccessible attribute now can be added to controllers (not just to actions), fixes #4504
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user