API Reference
Rockets Core API
nestjs-role
classes
RoleService

Class: RoleService

Implements

  • RoleServiceInterface

Constructors

new RoleService()

new RoleService(settings, allRoleRepos): RoleService

Parameters

ParameterType
settingsRoleSettingsInterface
allRoleReposRecord<string, Repository<RoleAssignmentEntityInterface>>

Returns

RoleService

Defined in

.tmp/repos/rockets/packages/nestjs-role/src/services/role.service.ts:22 (opens in a new tab)

Properties

PropertyModifierType
settingsreadonlyRoleSettingsInterface

Methods

getAssignedRoles()

getAssignedRoles(assignment, assignee, queryOptions?): Promise<RoleEntityInterface[]>

Get all roles for assignee.

Parameters

ParameterTypeDescription
assignmentstringThe assignment of the check (same as entity key)
assigneeReferenceIdInterface<string>The assignee to check
queryOptions?QueryOptionsInterface-

Returns

Promise<RoleEntityInterface[]>

Implementation of

RoleServiceInterface.getAssignedRoles

Defined in

.tmp/repos/rockets/packages/nestjs-role/src/services/role.service.ts:38 (opens in a new tab)


getAssignmentRepo()

protected getAssignmentRepo(assignment): Repository<RoleAssignmentEntityInterface>

Internal

Get the assignment repo for the given assignment.

Parameters

ParameterTypeDescription
assignmentstringThe role assignment

Returns

Repository<RoleAssignmentEntityInterface>

Defined in

.tmp/repos/rockets/packages/nestjs-role/src/services/role.service.ts:148 (opens in a new tab)


isAssignedRole()

isAssignedRole<T>(assignment, role, assignee, queryOptions?): Promise<boolean>

Check if the assignee is a member of one role.

Type Parameters

Type Parameter
T extends ReferenceIdInterface<string, T>

Parameters

ParameterTypeDescription
assignmentstringThe assignment of the check
roleReferenceIdInterface<string>The role to check
assigneeTThe assignee to check
queryOptions?QueryOptionsInterface-

Returns

Promise<boolean>

Implementation of

RoleServiceInterface.isAssignedRole

Defined in

.tmp/repos/rockets/packages/nestjs-role/src/services/role.service.ts:75 (opens in a new tab)


isAssignedRoles()

isAssignedRoles<T>(assignment, roles, assignee, queryOptions?): Promise<boolean>

Check if the assignee is a member of every role.

Type Parameters

Type Parameter
T extends ReferenceIdInterface<string, T>

Parameters

ParameterTypeDescription
assignmentstringThe assignment of the check
rolesReferenceIdInterface<string>[]The roles to check
assigneeTThe assignee to check
queryOptions?QueryOptionsInterface-

Returns

Promise<boolean>

Implementation of

RoleServiceInterface.isAssignedRoles

Defined in

.tmp/repos/rockets/packages/nestjs-role/src/services/role.service.ts:113 (opens in a new tab)