Skip to content

Commit 229bb42

Browse files
authored
Merge pull request #257 from dedis/mocks_auth
modify mocks
2 parents 3074f46 + b4f7363 commit 229bb42

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

web/frontend/src/mocks/handlers.ts

+5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ const isAuthorized = (roles: UserRole[]): boolean => {
5656

5757
export const handlers = [
5858
rest.get(ENDPOINT_PERSONAL_INFO, async (req, res, ctx) => {
59+
const auth = new Map<String, Array<String>>();
60+
auth.set('roles', ['list', 'remove', 'add']);
61+
auth.set('proxy', ['list', 'remove', 'add']);
62+
auth.set('election', ['create']);
5963
const isLogged = sessionStorage.getItem('is-authenticated') === 'true';
6064
const userId = isLogged ? mockUserID : 0;
6165
const userInfos = isLogged
@@ -64,6 +68,7 @@ export const handlers = [
6468
firstname: 'Alice',
6569
role: UserRole.Admin,
6670
sciper: userId,
71+
authorization: Object.fromEntries(auth),
6772
}
6873
: {};
6974
await new Promise((r) => setTimeout(r, RESPONSE_TIME));

0 commit comments

Comments
 (0)