RoleService
RoleService
Contains methods relating to Role entities.
Signature
class RoleService {
constructor(connection: TransactionalConnection, channelService: ChannelService, listQueryBuilder: ListQueryBuilder, configService: ConfigService, eventBus: EventBus, requestContextCache: RequestContextCacheService)
initRoles() => ;
findAll(ctx: RequestContext, options?: ListQueryOptions<Role>, relations?: RelationPaths<Role>) => Promise<PaginatedList<Role>>;
findOne(ctx: RequestContext, roleId: ID, relations?: RelationPaths<Role>) => Promise<Role | undefined>;
getChannelsForRole(ctx: RequestContext, roleId: ID) => Promise<Channel[]>;
getSuperAdminRole(ctx?: RequestContext) => Promise<Role>;
getCustomerRole(ctx?: RequestContext) => Promise<Role>;
getAllPermissions() => string[];
userHasPermissionOnChannel(ctx: RequestContext, channelId: ID, permission: Permission) => Promise<boolean>;
userHasAnyPermissionsOnChannel(ctx: RequestContext, channelId: ID, permissions: Permission[]) => Promise<boolean>;
userHasAllPermissionsOnChannel(ctx: RequestContext, channelId: ID, permissions: Permission[]) => Promise<boolean>;
create(ctx: RequestContext, input: CreateRoleInput) => Promise<Role>;
update(ctx: RequestContext, input: UpdateRoleInput) => Promise<Role>;
delete(ctx: RequestContext, id: ID) => Promise<DeletionResponse>;
assignRoleToChannel(ctx: RequestContext, roleId: ID, channelId: ID) => ;
}
constructor
method
(connection: TransactionalConnection, channelService: ChannelService, listQueryBuilder: ListQueryBuilder, configService: ConfigService, eventBus: EventBus, requestContextCache: RequestContextCacheService) => 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) =>