# Interface IPermissionService

Namespace
  adas_core.Application.Services.Interfaces

Assembly
  adas-core.Application.dll

    public interface IPermissionService

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Methods

### GetPermissionsForDisplay(Display, User)

Retrieves the set of display permission types applicable to the specified user for the given display.

    Task<DisplayPermissionTypes> GetPermissionsForDisplay(Display display, User user)

#### Parameters

`display` Display

  The display for which permissions are being evaluated.

`user` User

  The user whose permissions for the display are being retrieved.

#### Returns

Task<DisplayPermissionTypes>

  A task that represents the asynchronous operation, containing the DisplayPermissionTypes granted to the user for the display.

### GetPermissionsForPanel(string)

Retrieves the panel permission types associated with the specified user.

    Task<PanelPermissionTypes> GetPermissionsForPanel(string user)

#### Parameters

`user` string

  The identifier or name of the user whose panel permissions are being requested.

#### Returns

Task<PanelPermissionTypes>

  A task that represents the asynchronous operation, containing the PanelPermissionTypes granted to the user.

### GetPermissionsForPanel(User)

Retrieves the panel permission types associated with the specified user.

    PanelPermissionTypes GetPermissionsForPanel(User user)

#### Parameters

`user` User

  The user whose panel permissions are being queried.

#### Returns

PanelPermissionTypes

  The PanelPermissionTypes granted to the specified user.

### GetPermissionsForUnit(string, User)

Retrieves the display-friendly permission types applicable to the specified user for the given unit.

    Task<DisplayPermissionTypes> GetPermissionsForUnit(string unitId, User user)

#### Parameters

`unitId` string

  The identifier of the unit whose permissions are being queried.

`user` User

  The user whose permissions for the unit should be evaluated.

#### Returns

Task<DisplayPermissionTypes>

  A task that represents the asynchronous operation, containing the DisplayPermissionTypes for the specified unit and user.

### HasAccessToDisplay(string, RolesType, SourcePermissionsEnum, string)

Asynchronously checks whether the specified user, with the given role and source permission, has access to the specified display.

    Task<bool> HasAccessToDisplay(string username, PermissionEnum.RolesType role, PermissionEnum.SourcePermissionsEnum source, string displayId)

#### Parameters

`username` string

  The name of the user whose access is being verified.

`role` PermissionEnum.RolesType

  The role assigned to the user, used to determine access rights.

`source` PermissionEnum.SourcePermissionsEnum

  The source permission type considered when evaluating access.

`displayId` string

  The identifier of the display for which access is being checked.

#### Returns

Task<bool>

  A task that represents the asynchronous operation. The task result is `true` if the user has access to the display; otherwise, `false`.

### HasAccessToPanel(string, RolesType, SourcePermissionsEnum)

Asynchronously determines whether the specified user has access to a panel based on their role and the requested source permission.

    Task<bool> HasAccessToPanel(string username, PermissionEnum.RolesType role, PermissionEnum.SourcePermissionsEnum source)

#### Parameters

`username` string

  The identifier of the user whose panel access is being evaluated.

`role` PermissionEnum.RolesType

  The role assigned to the user, used to resolve applicable permissions.

`source` PermissionEnum.SourcePermissionsEnum

  The source permission being checked against the user's access rights.

#### Returns

Task<bool>

  A task that resolves to `true` if the user has access to the panel; otherwise, `false`.

### HasAccessToUnit(string, RolesType, SourcePermissionsEnum, string)

Asynchronously determines whether the specified user, with the given role and permission source, has access to the identified unit.

    Task<bool> HasAccessToUnit(string username, PermissionEnum.RolesType role, PermissionEnum.SourcePermissionsEnum source, string unitId)

#### Parameters

`username` string

  The identifier of the user whose access is being evaluated.

`role` PermissionEnum.RolesType

  The role assigned to the user, used in the access evaluation.

`source` PermissionEnum.SourcePermissionsEnum

  The permission source used to resolve the user's access rights.

`unitId` string

  The identifier of the unit to check access against.

#### Returns

Task<bool>

  A task that resolves to `true` if the user has access to the specified unit; otherwise, `false`.