FluentSecurity
FluentSecurity copied to clipboard
Ignore NonAction Methods
As per http://msdn.microsoft.com/en-us/library/system.web.mvc.nonactionattribute(v=vs.118).aspx, it would be reasonable to exclude nonaction methods.
I think it would suffice to change:
internal static bool IsValidActionMethod(this MethodInfo methodInfo, bool allowActionMethodsReturningVoid)
{
return
methodInfo.ReturnType.IsControllerActionReturnType(allowActionMethodsReturningVoid) &&
!methodInfo.GetCustomAttributes(typeof(NonActionAttribute), false).Any() &&
!methodInfo.IsSpecialName &&
!methodInfo.IsDeclaredBy<Controller>();
}
NOT TESTED. If the feature is accepted, I can modify this.
Good catch! I did not even know such an attribute existed. When was this introduced? I'll add it to the todo list. Thanks...
I will take a stab at this over weekend and send PR if possible.
@Chandu Great!! Looking forward to it.
@kristofferahl @hernangm Pushed working implementation of the this feature to branch on my fork. Am not sure if this needs any changes to FluentSecurity.Testing. Can you take a look @ https://github.com/Chandu/FluentSecurity/commit/2f6e453c2eed81b04f17aabe03dfff72d013d196 and see if something is missing?
Looks good! I think you can go ahead and make this a pull-request to the develop branch and merge it. :)
Merged the changes to develop. Merge commit: 2a05263be
Great @Chandu! Just checked and there is now a nightly build available containing this fix.
https://www.myget.org/gallery/fluentsecurity FluentSecurity.v2.1.0-build452