Class AuthorizationService
Provides authorization services for managing permission sets for users.
Implements
Inherited Members
Namespace: DataWeb.Authorization
Assembly: DataWeb.Core.dll
Syntax
public class AuthorizationService : 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.
Constructors
AuthorizationService(IReflectionService, IAppErrorService, IServiceProvider, IPermissionSetStore)
Provides authorization services for managing permission sets for users.
Declaration
public AuthorizationService(IReflectionService reflectionService, IAppErrorService appErrorService, IServiceProvider serviceProvider, IPermissionSetStore permissionSetStore)
Parameters
| Type | Name | Description |
|---|---|---|
| IReflectionService | reflectionService | |
| IAppErrorService | appErrorService | |
| IServiceProvider | serviceProvider | |
| IPermissionSetStore | permissionSetStore |
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
public 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
public 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. |