mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(core): Only show personal credentials in the personal space (#12433)
This commit is contained in:
@@ -632,25 +632,25 @@ describe('GET /credentials', () => {
|
||||
expect(response.body.data.map((credential) => credential.id)).toContain(memberCredential.id);
|
||||
});
|
||||
|
||||
test('should return all credentials to instance owners when working on their own personal project', async () => {
|
||||
test('should not ignore the project filter when the request is done by an owner and also includes the scopes', async () => {
|
||||
const ownerCredential = await saveCredential(payload(), {
|
||||
user: owner,
|
||||
role: 'credential:owner',
|
||||
});
|
||||
const memberCredential = await saveCredential(payload(), {
|
||||
user: member,
|
||||
role: 'credential:owner',
|
||||
});
|
||||
// should not show up
|
||||
await saveCredential(payload(), { user: member, role: 'credential:owner' });
|
||||
|
||||
const response: GetAllResponse = await testServer
|
||||
.authAgentFor(owner)
|
||||
.get('/credentials')
|
||||
.query(`filter={ "projectId": "${ownerPersonalProject.id}" }&includeScopes=true`)
|
||||
.query({
|
||||
filter: JSON.stringify({ projectId: ownerPersonalProject.id }),
|
||||
includeScopes: true,
|
||||
})
|
||||
.expect(200);
|
||||
|
||||
expect(response.body.data).toHaveLength(2);
|
||||
expect(response.body.data.map((credential) => credential.id)).toContain(ownerCredential.id);
|
||||
expect(response.body.data.map((credential) => credential.id)).toContain(memberCredential.id);
|
||||
expect(response.body.data).toHaveLength(1);
|
||||
expect(response.body.data[0].id).toBe(ownerCredential.id);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user