-
-
Notifications
You must be signed in to change notification settings - Fork 728
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add group project roles to project roles (#8245)
This PR adds project roles you get from groups to the list of roles listed for each project.
- Loading branch information
1 parent
957ef12
commit 289324f
Showing
2 changed files
with
100 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import { | |
} from '../../../test/e2e/helpers/test-helper'; | ||
import getLogger from '../../../test/fixtures/no-logger'; | ||
import type { IUser } from '../../types'; | ||
import { randomId } from '../../util'; | ||
|
||
let app: IUnleashTest; | ||
let db: ITestDb; | ||
|
@@ -38,6 +39,7 @@ afterAll(async () => { | |
|
||
beforeEach(async () => { | ||
await db.stores.featureToggleStore.deleteAll(); | ||
await db.stores.userStore.deleteAll(); | ||
}); | ||
|
||
test('should return personal dashboard with own flags and favorited flags', async () => { | ||
|
@@ -135,6 +137,67 @@ test('should return personal dashboard with membered projects', async () => { | |
}); | ||
}); | ||
|
||
test('should return projects where users are part of a group', () => { | ||
// TODO | ||
test('should return projects where users are part of a group', async () => { | ||
const { body: user1 } = await loginUser('[email protected]'); | ||
const projectA = await createProject(`x${randomId()}`, user1); | ||
|
||
const { body: user2 } = await loginUser('[email protected]'); | ||
|
||
const group = await app.services.groupService.createGroup( | ||
{ | ||
name: 'groupA', | ||
users: [{ user: user2 }], | ||
}, | ||
user1, | ||
); | ||
|
||
await app.services.projectService.addAccess( | ||
projectA.id, | ||
[5], // member role | ||
[], | ||
[user2.id], | ||
user1, | ||
); | ||
|
||
await app.services.projectService.addAccess( | ||
projectA.id, | ||
[4], // owner role | ||
[group.id], | ||
[], | ||
user1, | ||
); | ||
|
||
const { body } = await app.request.get(`/api/admin/personal-dashboard`); | ||
|
||
expect(body).toMatchObject({ | ||
projects: [ | ||
{ | ||
name: 'Default', | ||
id: 'default', | ||
roles: [ | ||
{ | ||
name: 'Editor', | ||
id: 2, | ||
type: 'root', | ||
}, | ||
], | ||
}, | ||
{ | ||
name: projectA.name, | ||
id: projectA.id, | ||
roles: [ | ||
{ | ||
name: 'Owner', | ||
id: 4, | ||
type: 'project', | ||
}, | ||
{ | ||
name: 'Member', | ||
id: 5, | ||
type: 'project', | ||
}, | ||
], | ||
}, | ||
], | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters