Interface IAuthorizationService
Provides authorization services for managing permission sets for users.
Namespace: DataWeb.Authorization
Assembly: DataWeb.Core.dll
Syntax
public interface IAuthorizationService
Remarks
This service acts as the main entry point for the authorization system, providing methods to retrieve and initialize permission sets for authenticated users.
Methods
GetPermissionSetAsync(string, IUser, CancellationToken)
Asynchronously retrieves a permission set for the specified user by name.
Declaration
Task<PermissionSet> GetPermissionSetAsync(string name, IUser user, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the permission set to retrieve. |
| IUser | user | The IUser for which the permission set should be retrieved. |
| CancellationToken | cancellationToken | The cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<PermissionSet> | A Task that represents the asynchronous operation. The task result contains the retrieved PermissionSet. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when name or user is null or empty. |
| InvalidOperationException | Thrown when the permission set with the specified name is not found. |
GetPermissionSetsAsync(IUser, CancellationToken)
Asynchronously retrieves all permission sets for the specified user.
Declaration
Task<IEnumerable<PermissionSet>> GetPermissionSetsAsync(IUser user, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The IUser for which the permission sets should be retrieved. |
| CancellationToken | cancellationToken | The cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<PermissionSet>> | A Task that represents the asynchronous operation. The task result contains an IEnumerable<T> of PermissionSet instances, or an empty collection if no permission sets are defined. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when user is null. |