Skip to main content

RoleService

Contains methods relating to Role entities.

Signature

constructor

method(connection: TransactionalConnection, channelService: ChannelService, listQueryBuilder: ListQueryBuilder, configService: ConfigService, eventBus: EventBus, requestContextCache: RequestContextCacheService, cacheService: CacheService) => RoleService

initRoles

method() =>

findAll

method(ctx: RequestContext, options?: ListQueryOptions<Role>, relations?: RelationPaths<Role>) => Promise<PaginatedList<Role>>

findOne

method(ctx: RequestContext, roleId: ID, relations?: RelationPaths<Role>) => Promise<Role | undefined>

getChannelsForRole

method(ctx: RequestContext, roleId: ID) => Promise<Channel[]>

getSuperAdminRole

method(ctx?: RequestContext) => Promise<Role>

Returns the special SuperAdmin Role, which always exists in Vendure.

getCustomerRole

method(ctx?: RequestContext) => Promise<Role>

Returns the special Customer Role, which always exists in Vendure.

getAllPermissions

method() => string[]

Returns all the valid Permission values

userHasPermissionOnChannel

method(ctx: RequestContext, channelId: ID, permission: Permission) => Promise<boolean>

Returns true if the User has the specified permission on that Channel

userHasAnyPermissionsOnChannel

method(ctx: RequestContext, channelId: ID, permissions: Permission[]) => Promise<boolean>

Returns true if the User has any of the specified permissions on that Channel

userHasAllPermissionsOnChannel

method(ctx: RequestContext, channelId: ID, permissions: Permission[]) => Promise<boolean>

Returns true if the User has all the specified permissions on that Channel

create

method(ctx: RequestContext, input: CreateRoleInput) => Promise<Role>

update

method(ctx: RequestContext, input: UpdateRoleInput) => Promise<Role>

delete

method(ctx: RequestContext, id: ID) => Promise<DeletionResponse>

assignRoleToChannel

method(ctx: RequestContext, roleId: ID, channelId: ID) =>
Was this chapter helpful?
Report Issue
Edited Feb 25, 2026ยทEdit this page