Setu-TS
    Preparing search index...

    Interface IAuthorizationService

    Authorization service for RBAC with role hierarchy.

    0.1.0

    interface IAuthorizationService {
        hasAllPermissions(
            principal: IPrincipal,
            permissions: readonly string[],
        ): boolean;
        hasAnyRole(principal: IPrincipal, roles: readonly string[]): boolean;
        hasPermission(principal: IPrincipal, permission: string): boolean;
        hasRole(principal: IPrincipal, role: string): boolean;
    }
    Index
    • Check if a principal has all of the specified permissions.

      Parameters

      • principal: IPrincipal

        The principal to check

      • permissions: readonly string[]

        The permission names to check

      Returns boolean

      true if the principal has all permissions

    • Check if a principal has any of the specified roles.

      Parameters

      • principal: IPrincipal

        The principal to check

      • roles: readonly string[]

        The role names to check

      Returns boolean

      true if the principal has any of the roles

    • Check if a principal has a specific permission (direct or via role hierarchy).

      Parameters

      • principal: IPrincipal

        The principal to check

      • permission: string

        The permission to check

      Returns boolean

      true if the principal has the permission

    • Check if a principal has a specific role (including inherited roles).

      Parameters

      • principal: IPrincipal

        The principal to check

      • role: string

        The role name to check

      Returns boolean

      true if the principal has the role