mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat: Replace owner checks with scope checks (no-changelog) (#7846)
Github issue / Community forum post (link here to close automatically):
This commit is contained in:
@@ -362,7 +362,6 @@ describe('PATCH /users/:id/role', () => {
|
||||
let authlessAgent: SuperAgentTest;
|
||||
|
||||
const {
|
||||
NO_MEMBER,
|
||||
MISSING_NEW_ROLE_KEY,
|
||||
MISSING_NEW_ROLE_VALUE,
|
||||
NO_ADMIN_ON_OWNER,
|
||||
@@ -372,6 +371,8 @@ describe('PATCH /users/:id/role', () => {
|
||||
NO_ADMIN_IF_UNLICENSED,
|
||||
} = UsersController.ERROR_MESSAGES.CHANGE_ROLE;
|
||||
|
||||
const UNAUTHORIZED = 'Unauthorized';
|
||||
|
||||
beforeAll(async () => {
|
||||
await testDb.truncate(['User']);
|
||||
|
||||
@@ -406,7 +407,7 @@ describe('PATCH /users/:id/role', () => {
|
||||
});
|
||||
|
||||
expect(response.statusCode).toBe(403);
|
||||
expect(response.body.message).toBe(NO_MEMBER);
|
||||
expect(response.body.message).toBe(UNAUTHORIZED);
|
||||
});
|
||||
|
||||
test('should fail to demote owner to admin', async () => {
|
||||
@@ -415,7 +416,7 @@ describe('PATCH /users/:id/role', () => {
|
||||
});
|
||||
|
||||
expect(response.statusCode).toBe(403);
|
||||
expect(response.body.message).toBe(NO_MEMBER);
|
||||
expect(response.body.message).toBe(UNAUTHORIZED);
|
||||
});
|
||||
|
||||
test('should fail to demote admin to member', async () => {
|
||||
@@ -424,7 +425,7 @@ describe('PATCH /users/:id/role', () => {
|
||||
});
|
||||
|
||||
expect(response.statusCode).toBe(403);
|
||||
expect(response.body.message).toBe(NO_MEMBER);
|
||||
expect(response.body.message).toBe(UNAUTHORIZED);
|
||||
});
|
||||
|
||||
test('should fail to promote other member to owner', async () => {
|
||||
@@ -433,7 +434,7 @@ describe('PATCH /users/:id/role', () => {
|
||||
});
|
||||
|
||||
expect(response.statusCode).toBe(403);
|
||||
expect(response.body.message).toBe(NO_MEMBER);
|
||||
expect(response.body.message).toBe(UNAUTHORIZED);
|
||||
});
|
||||
|
||||
test('should fail to promote other member to admin', async () => {
|
||||
@@ -442,7 +443,7 @@ describe('PATCH /users/:id/role', () => {
|
||||
});
|
||||
|
||||
expect(response.statusCode).toBe(403);
|
||||
expect(response.body.message).toBe(NO_MEMBER);
|
||||
expect(response.body.message).toBe(UNAUTHORIZED);
|
||||
});
|
||||
|
||||
test('should fail to promote self to admin', async () => {
|
||||
@@ -451,7 +452,7 @@ describe('PATCH /users/:id/role', () => {
|
||||
});
|
||||
|
||||
expect(response.statusCode).toBe(403);
|
||||
expect(response.body.message).toBe(NO_MEMBER);
|
||||
expect(response.body.message).toBe(UNAUTHORIZED);
|
||||
});
|
||||
|
||||
test('should fail to promote self to owner', async () => {
|
||||
@@ -460,7 +461,7 @@ describe('PATCH /users/:id/role', () => {
|
||||
});
|
||||
|
||||
expect(response.statusCode).toBe(403);
|
||||
expect(response.body.message).toBe(NO_MEMBER);
|
||||
expect(response.body.message).toBe(UNAUTHORIZED);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user