mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-21 18:55:19 -04:00
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:
parent
24f1b2a361
commit
c2f41118b6
27 changed files with 287 additions and 66 deletions
|
@ -7,15 +7,22 @@ import * as useApplicationStateModule from '../hooks/common/use-application-stat
|
|||
import type { ApplicationState } from '../redux/application-state'
|
||||
|
||||
jest.mock('../hooks/common/use-application-state')
|
||||
export const mockNoteOwnership = (ownUsername: string, noteOwner: string) => {
|
||||
export const mockNoteOwnership = (
|
||||
ownUsername: string,
|
||||
noteOwner: string,
|
||||
additionalState?: Partial<ApplicationState>
|
||||
) => {
|
||||
jest.spyOn(useApplicationStateModule, 'useApplicationState').mockImplementation((fn) => {
|
||||
return fn({
|
||||
...additionalState,
|
||||
noteDetails: {
|
||||
...additionalState?.noteDetails,
|
||||
permissions: {
|
||||
owner: noteOwner
|
||||
}
|
||||
},
|
||||
user: {
|
||||
...additionalState?.user,
|
||||
username: ownUsername
|
||||
}
|
||||
} as ApplicationState)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue