test(permissions): use manage permission in relevant tests
This commit is contained in:
@@ -20,7 +20,7 @@ describe('POST /api/v1/flows', () => {
|
||||
|
||||
it('should create an empty flow when no templateId is provided', async () => {
|
||||
await createPermission({
|
||||
action: 'create',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -42,7 +42,7 @@ describe('POST /api/v1/flows', () => {
|
||||
|
||||
it('should create a flow from template when templateId is provided', async () => {
|
||||
await createPermission({
|
||||
action: 'create',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
|
||||
@@ -36,7 +36,7 @@ describe('POST /api/v1/flows/:flowId/steps', () => {
|
||||
await createPermission({
|
||||
roleId: currentUser.roleId,
|
||||
subject: 'Flow',
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
conditions: ['isCreator'],
|
||||
});
|
||||
|
||||
@@ -78,7 +78,7 @@ describe('POST /api/v1/flows/:flowId/steps', () => {
|
||||
await createPermission({
|
||||
roleId: currentUser.roleId,
|
||||
subject: 'Flow',
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
conditions: [],
|
||||
});
|
||||
|
||||
@@ -109,7 +109,7 @@ describe('POST /api/v1/flows/:flowId/steps', () => {
|
||||
await createPermission({
|
||||
roleId: currentUser.roleId,
|
||||
subject: 'Flow',
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
conditions: ['isCreator'],
|
||||
});
|
||||
|
||||
@@ -133,7 +133,7 @@ describe('POST /api/v1/flows/:flowId/steps', () => {
|
||||
await createPermission({
|
||||
roleId: currentUser.roleId,
|
||||
subject: 'Flow',
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
conditions: ['isCreator'],
|
||||
});
|
||||
|
||||
@@ -159,7 +159,7 @@ describe('POST /api/v1/flows/:flowId/steps', () => {
|
||||
await createPermission({
|
||||
roleId: currentUser.roleId,
|
||||
subject: 'Flow',
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
conditions: ['isCreator'],
|
||||
});
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ describe('DELETE /api/v1/flows/:flowId', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'delete',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -52,7 +52,7 @@ describe('DELETE /api/v1/flows/:flowId', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'delete',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: [],
|
||||
@@ -73,7 +73,7 @@ describe('DELETE /api/v1/flows/:flowId', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'delete',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -96,7 +96,7 @@ describe('DELETE /api/v1/flows/:flowId', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'delete',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
|
||||
@@ -48,7 +48,7 @@ describe('POST /api/v1/flows/:flowId/duplicate', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'create',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -106,7 +106,7 @@ describe('POST /api/v1/flows/:flowId/duplicate', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'create',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: [],
|
||||
@@ -143,7 +143,7 @@ describe('POST /api/v1/flows/:flowId/duplicate', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'create',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -169,7 +169,7 @@ describe('POST /api/v1/flows/:flowId/duplicate', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'create',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -190,7 +190,7 @@ describe('POST /api/v1/flows/:flowId/duplicate', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'create',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
|
||||
@@ -56,7 +56,7 @@ describe('POST /api/v1/flows/:flowId/export', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -113,7 +113,7 @@ describe('POST /api/v1/flows/:flowId/export', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: [],
|
||||
@@ -141,7 +141,7 @@ describe('POST /api/v1/flows/:flowId/export', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -167,7 +167,7 @@ describe('POST /api/v1/flows/:flowId/export', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -188,7 +188,7 @@ describe('POST /api/v1/flows/:flowId/export', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
|
||||
@@ -48,7 +48,7 @@ describe('POST /api/v1/flows/import', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'create',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -124,7 +124,7 @@ describe('POST /api/v1/flows/import', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'create',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -206,7 +206,7 @@ describe('POST /api/v1/flows/import', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'create',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -279,7 +279,7 @@ describe('POST /api/v1/flows/import', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'create',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -330,7 +330,7 @@ describe('POST /api/v1/flows/import', () => {
|
||||
const currentUserFlow = await createFlow({ userId: currentUser.id });
|
||||
|
||||
await createPermission({
|
||||
action: 'create',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
|
||||
@@ -45,7 +45,7 @@ describe('PATCH /api/v1/flows/:flowId/folder', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -77,7 +77,7 @@ describe('PATCH /api/v1/flows/:flowId/folder', () => {
|
||||
const anotherUserFlow = await createFlow({ userId: anotherUser.id });
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: [],
|
||||
@@ -96,7 +96,7 @@ describe('PATCH /api/v1/flows/:flowId/folder', () => {
|
||||
const anotherUserFolder = await createFolder({ userId: anotherUser.id });
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: [],
|
||||
@@ -111,7 +111,7 @@ describe('PATCH /api/v1/flows/:flowId/folder', () => {
|
||||
|
||||
it('should return not found response for not existing flow UUID', async () => {
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -130,7 +130,7 @@ describe('PATCH /api/v1/flows/:flowId/folder', () => {
|
||||
const flow = await createFlow({ userId: currentUser.id });
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -147,7 +147,7 @@ describe('PATCH /api/v1/flows/:flowId/folder', () => {
|
||||
|
||||
it('should return bad request response for invalid flow UUID', async () => {
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
});
|
||||
@@ -160,7 +160,7 @@ describe('PATCH /api/v1/flows/:flowId/folder', () => {
|
||||
|
||||
it('should return bad request response for invalid folder UUID', async () => {
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
});
|
||||
|
||||
@@ -51,7 +51,7 @@ describe('PATCH /api/v1/flows/:flowId/status', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'publish',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -114,7 +114,7 @@ describe('PATCH /api/v1/flows/:flowId/status', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'publish',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: [],
|
||||
@@ -152,7 +152,7 @@ describe('PATCH /api/v1/flows/:flowId/status', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'publish',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -178,7 +178,7 @@ describe('PATCH /api/v1/flows/:flowId/status', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'publish',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -199,7 +199,7 @@ describe('PATCH /api/v1/flows/:flowId/status', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'publish',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('PATCH /api/v1/flows/:flowId', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -65,7 +65,7 @@ describe('PATCH /api/v1/flows/:flowId', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: [],
|
||||
@@ -98,7 +98,7 @@ describe('PATCH /api/v1/flows/:flowId', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -121,7 +121,7 @@ describe('PATCH /api/v1/flows/:flowId', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
@@ -144,7 +144,7 @@ describe('PATCH /api/v1/flows/:flowId', () => {
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'update',
|
||||
action: 'manage',
|
||||
subject: 'Flow',
|
||||
roleId: currentUserRole.id,
|
||||
conditions: ['isCreator'],
|
||||
|
||||
Reference in New Issue
Block a user