mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 16:44:07 -08:00
7a86d36068
https://linear.app/n8n/issue/PAY-985 ``` PATCH /users/:id/role unauthenticated user ✓ should receive 401 (349 ms) member ✓ should fail to demote owner to member (349 ms) ✓ should fail to demote owner to admin (359 ms) ✓ should fail to demote admin to member (381 ms) ✓ should fail to promote other member to owner (353 ms) ✓ should fail to promote other member to admin (377 ms) ✓ should fail to promote self to admin (354 ms) ✓ should fail to promote self to owner (371 ms) admin ✓ should receive 400 on invalid payload (351 ms) ✓ should receive 404 on unknown target user (351 ms) ✓ should fail to demote owner to admin (349 ms) ✓ should fail to demote owner to member (347 ms) ✓ should fail to promote member to owner (384 ms) ✓ should fail to promote admin to owner (350 ms) ✓ should be able to demote admin to member (354 ms) ✓ should be able to demote self to member (350 ms) ✓ should be able to promote member to admin (349 ms) owner ✓ should be able to promote member to admin (349 ms) ✓ should be able to demote admin to member (349 ms) ✓ should fail to demote self to admin (348 ms) ✓ should fail to demote self to member (354 ms) ```
36 lines
914 B
TypeScript
36 lines
914 B
TypeScript
import Container from 'typedi';
|
|
import { RoleService } from '@/services/role.service';
|
|
|
|
export async function getGlobalOwnerRole() {
|
|
return Container.get(RoleService).findGlobalOwnerRole();
|
|
}
|
|
|
|
export async function getGlobalMemberRole() {
|
|
return Container.get(RoleService).findGlobalMemberRole();
|
|
}
|
|
|
|
export async function getGlobalAdminRole() {
|
|
return Container.get(RoleService).findGlobalAdminRole();
|
|
}
|
|
|
|
export async function getWorkflowOwnerRole() {
|
|
return Container.get(RoleService).findWorkflowOwnerRole();
|
|
}
|
|
|
|
export async function getWorkflowEditorRole() {
|
|
return Container.get(RoleService).findWorkflowEditorRole();
|
|
}
|
|
|
|
export async function getCredentialOwnerRole() {
|
|
return Container.get(RoleService).findCredentialOwnerRole();
|
|
}
|
|
|
|
export async function getAllRoles() {
|
|
return Promise.all([
|
|
getGlobalOwnerRole(),
|
|
getGlobalMemberRole(),
|
|
getWorkflowOwnerRole(),
|
|
getCredentialOwnerRole(),
|
|
]);
|
|
}
|