ServiceAuthorizeAttribute class
namespace: Serenity.Services assembly: Serenity.Net.Web
Authorizes access to a service action. Optionally checks the permission provided as the first argument. Use special permission key ? to check for logged-in users, and * to allow anyone including anonymous access. This returns a service error instead of raising an exception like PageAuthorizeAttribute.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class ServiceAuthorizeAttribute : Attribute, IResourceFilter
Public Members
| name | description |
|---|---|
| ServiceAuthorizeAttribute() | Initializes a new instance of the ServiceAuthorizeAttribute class. |
| ServiceAuthorizeAttribute(…) | Initializes an instance of the ServiceAuthorizeAttribute class, while deriving the permission key from the passed type's ReadPermissionAttribute. (4 constructors) |
| Override { get; set; } | Gets or sets whether this attribute should override the controller level attribute if any. The default is true. |
| Permission { get; } | Gets the permission key. |
| OnResourceExecuted(…) | |
| OnResourceExecuting(…) |
Protected Members
| name | description |
|---|---|
| ServiceAuthorizeAttribute(…) | Initializes an instance of the service authorize attribute while trying to determine the permission key from one of the permission attribute types the source type has. |
| OrPermission { get; set; } | Gets or sets an optional secondary permission to check by OR, e.g. if this is specified and the user does not have the Permission, the user will still be allowed access if they have the OrPermission. |
See Also
- Source: ServiceAuthorizeAttribute.cs