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,11 +1,11 @@
/*
* 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
*/
import { store } from '..'
import { getNoteMetadata } from '../../api/notes'
import type { Note, NotePermissions } from '../../api/notes/types'
import type { Note } from '../../api/notes/types'
import type { CursorSelection } from '../../components/editor-page/editor-pane/tool-bar/formatters/types/cursor-selection'
import type {
SetNoteDetailsFromServerAction,
@ -16,6 +16,7 @@ import type {
UpdateNoteTitleByFirstHeadingAction
} from './types'
import { NoteDetailsActionType } from './types'
import type { NotePermissions } from '@hedgedoc/commons'
/**
* Sets the content of the current note, extracts and parses the frontmatter and extracts the markdown content part.

View file

@ -3,10 +3,10 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { NotePermissions } from '../../../api/notes/types'
import { initialState } from '../initial-state'
import type { NoteDetails } from '../types/note-details'
import { buildStateFromServerPermissions } from './build-state-from-server-permissions'
import type { NotePermissions } from '@hedgedoc/commons'
describe('build state from server permissions', () => {
it('creates a new state with the given permissions', () => {

View file

@ -1,10 +1,10 @@
/*
* 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
*/
import type { NotePermissions } from '../../../api/notes/types'
import type { NoteDetails } from '../types/note-details'
import type { NotePermissions } from '@hedgedoc/commons'
/**
* Builds the updated state from a given previous state and updated NotePermissions data.

View file

@ -1,10 +1,11 @@
/*
* 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
*/
import type { Note, NoteMetadata, NotePermissions } from '../../api/notes/types'
import type { Note, NoteMetadata } from '../../api/notes/types'
import type { CursorSelection } from '../../components/editor-page/editor-pane/tool-bar/formatters/types/cursor-selection'
import type { NotePermissions } from '@hedgedoc/commons'
import type { Action } from 'redux'
export enum NoteDetailsActionType {