AllowOnlyEditorAttribute Class |
Namespace: CMS.WebApi
public sealed class AllowOnlyEditorAttribute : AuthorizationFilterAttribute
The AllowOnlyEditorAttribute type exposes the following members.
Name | Description | |
---|---|---|
AllowOnlyEditorAttribute |
Name | Description | |
---|---|---|
OnAuthorization |
Calls when a process requests authorization.
(Overrides AuthorizationFilterAttribute.OnAuthorization(HttpActionContext).) |
This API supports the framework infrastructure and is not intended to be used directly from your code.
It is preferable to use this AllowOnlyEditorAttribute over the default Web API AuthorizeAttribute, since this filter logs exceptions to the event log and handles Windows authentication properly for the CMS administration. However, this attribute does not work with the AllowAnonymousAttribute, so it should not be used within the controller which is already decorated with the AllowOnlyEditorAttribute. This attribute is not intended to be used in customer code directly.
[AllowOnlyEditor] public class MyController : ApiController { // For accessing this method user has to be authorized. public HttpResponseMessage GetValue() { ... } }
public class MyController : ApiController { [AllowOnlyEditor] // For accessing this method user has to authorized. public HttpResponseMessage GetAuthorized() { ... } // While this action can be accessed even by public user. public HttpResponseMessage GetPublic() { ... } }