feat: check permissions in realtime code and frontend

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Philip Molares 2023-03-26 14:51:18 +02:00 committed by Tilman Vatteroth
parent 24f1b2a361
commit c2f41118b6
27 changed files with 287 additions and 66 deletions

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
@ -195,8 +195,18 @@ describe('Websocket gateway', () => {
}
});
const mockedNote = Mock.of<Note>({ id: 4711 });
const mockedGuestNote = Mock.of<Note>({ id: 1235 });
const mockedNote = Mock.of<Note>({
id: 4711,
owner: Promise.resolve(mockUser),
userPermissions: Promise.resolve([]),
groupPermissions: Promise.resolve([]),
});
const mockedGuestNote = Mock.of<Note>({
id: 1235,
owner: Promise.resolve(null),
userPermissions: Promise.resolve([]),
groupPermissions: Promise.resolve([]),
});
jest
.spyOn(notesService, 'getNoteByIdOrAlias')
.mockImplementation((noteId: string) => {