Commit graph

3250 commits

Author SHA1 Message Date
David Mehren
29804ec6c2
Merge pull request #941 from hedgedoc/renovate/develop-linters
Update linters to v4.15.2 (develop)
2021-02-25 20:19:53 +01:00
Renovate Bot
4b0298e393
Update linters to v4.15.2
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-25 19:07:03 +00:00
David Mehren
7d2fa9205f
Merge pull request #949 from hedgedoc/renovate/develop-ts-jest-26.x
Update dependency ts-jest to v26.5.2 (develop)
2021-02-25 20:06:05 +01:00
Renovate Bot
4a33fd9fa2
Update dependency ts-jest to v26.5.2
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-25 19:03:08 +00:00
David Mehren
e70683eca2
Merge pull request #952 from hedgedoc/renovate/develop-rxjs-6.x
Update dependency rxjs to v6.6.6 (develop)
2021-02-25 20:01:38 +01:00
Renovate Bot
e021687440
Update dependency rxjs to v6.6.6
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-25 01:19:34 +00:00
David Mehren
4ab6db0031
Merge pull request #940 from hedgedoc/renovate/develop-nestjs-packages
Update NestJS packages (develop)
2021-02-24 18:08:27 +01:00
Renovate Bot
c166d5bad2
Update NestJS packages
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-24 14:12:26 +00:00
David Mehren
0dd1f80db4
Merge pull request #948 from hedgedoc/fix/unusedImports
PermissionsModule: Remove unused imports
2021-02-23 21:09:26 +01:00
David Mehren
3fabf2596a
Merge pull request #943 from hedgedoc/refactor/getNoteContent 2021-02-23 21:05:25 +01:00
Philip Molares
0e6cc0b971 PermissionsModule: Remove unused imports
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-23 19:13:41 +01:00
Yannick Bungers
6b88aaca45
Merge pull request #944 from hedgedoc/refactor/viewcount
Note: Rename viewcount to viewCount for compliance
2021-02-23 15:11:23 +01:00
Yannick Bungers
b7e188cec2 Rename viewcount to viewCount for compliance
Signed-off-by: Yannick Bungers <git@innay.de>
2021-02-22 23:36:44 +01:00
Yannick Bungers
e081bd196b Rename getNoteContentByNote to getNoteContent
Signed-off-by: Yannick Bungers <git@innay.de>
2021-02-22 22:34:18 +01:00
Yannick Bungers
15a1a138ee Remove unused getNoteContentByIdOrAlias
Signed-off-by: Yannick Bungers <git@innay.de>
2021-02-22 22:32:00 +01:00
David Mehren
3f05fa4852
Merge pull request #848 from hedgedoc/feature/noteService 2021-02-20 21:46:17 +01:00
Philip Molares
5f49cb8d48 NotesService: Replace noteByIdOrAlias with note as parameter
As the NotesController has the note already, because it checked with it if the user has the permission to perform the action, it's not necessary to get the note from the DB again, instead we should just provide the note to the functions directly.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 19:51:27 +01:00
Philip Molares
c9b05b3c44 NotesController: Handle new errors
Handle the AlreadyInDB and PermissionsUpdateInconsistent errors and correctly show them to the api user as BadRequest errors.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 19:51:27 +01:00
Philip Molares
54286d589d NotesE2ETests: Ensure posting the same note alias twice fails
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 19:51:27 +01:00
Philip Molares
93d859647d NotesService: Add unit tests
Fixed toUserDto method of UsersService: If a user has no email an empty string should be returned (like with the photoUrl) instead of null.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 19:51:24 +01:00
Philip Molares
4332b039d6 NotesService: Finished hardcoded functions
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 19:45:16 +01:00
Philip Molares
8b29e32e45 Errors: Add AlreadyInDB and PermissionsUpdateInconsistent error
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 16:54:08 +01:00
Philip Molares
34087561e7 GroupsService: Create new GroupsService
This service is necessary as we plan to have functions to create and manipulate groups in the future.
The GroupInfoDto was moved from the file note-permissions.dto.ts to mimic the UserInfoDto.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 16:52:18 +01:00
David Mehren
3b5f199ce2
Merge pull request #933 from hedgedoc/renovate/develop-definitelytyped
Update dependency @types/node to v13.13.45 (develop)
2021-02-20 11:57:06 +01:00
Philip Molares
577811be29 NotePermissions: Remove default constructors
As discussed in #835 we don't want to have default constructors and prefer .create methods.
Because the created NoteGroupPermission and NoteUserPermission are not saved to the DB by themselves, but are saved via a change to the Note using a Pick<Class, attributes>-style return type is not helpful here as every single time the .create functions are called a full object is required.
The mock calls in the PermissionService test are not needed and break the .create calls so they got removed.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 11:38:50 +01:00
Philip Molares
353384435e NotesService: Add JsDoc strings to all functions
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 11:28:19 +01:00
Renovate Bot
9f27657da5
Update dependency @types/node to v13.13.45
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-20 10:17:41 +00:00
David Mehren
91044a82c1
Merge pull request #932 from hedgedoc/docs/supported-dbs 2021-02-20 10:46:56 +01:00
Philip Molares
336117cef5 NotesService: Rename getCurrentContent to getNoteContentByNote
The new name should better explain what this functions does.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-19 13:36:01 +01:00
David Mehren
5fac0db8a6
Document supported databases in 2.0
Closes #447

Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-19 12:50:16 +01:00
David Mehren
443f58e39d
Add intention of 2.0 development docs
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-19 12:43:55 +01:00
David Mehren
0131297fbb
Merge pull request #931 from hedgedoc/renovate/develop-definitelytyped
Update dependency @types/node to v13.13.44 (develop)
2021-02-19 11:35:25 +01:00
Renovate Bot
099d9c684c
Update dependency @types/node to v13.13.44
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-19 05:29:49 +00:00
Yannick Bungers
c6bc0dc85c
Merge pull request #777 from hedgedoc/feat/permissionchecking 2021-02-18 22:52:36 +01:00
Philip Molares
8e9717c92a NotesE2E: Fix e2e test
split success and fail cases in separate tests for better readability
add the correct user to all notes created by service (instead of api) to make the permissions checks viable.
extracted test content of notes to a global variable.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-18 22:25:55 +01:00
Philip Molares
1aa821460f NotesController: Catch NotInDBErrors from permission checks
The permission check also tries to get the note and a non existing note needs to be handled there too.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-18 22:25:55 +01:00
Yannick Bungers
0fc9c11a41 Add test for permission service
Many tests are generated and not static like in other files.

Signed-off-by: Yannick Bungers <git@innay.de>
2021-02-18 22:25:55 +01:00
Yannick Bungers
0ea7991e36 Add guest permission mock and checking
mocked by attribute of permission service

Signed-off-by: Yannick Bungers <git@innay.de>
2021-02-18 22:25:55 +01:00
Yannick Bungers
a694d71fff Add permission checks for notes routes
Signed-off-by: Yannick Bungers <git@innay.de>
2021-02-18 22:25:55 +01:00
Yannick Bungers
f40ed5db2a Add permissions Service
Checks if the given user has sufficient rights on the given resource.

Signed-off-by: Yannick Bungers <git@innay.de>
2021-02-18 22:25:55 +01:00
Yannick Bungers
f8e07f6940 Add relation between User and Group
This represents the users which are members of this group

Signed-off-by: Yannick Bungers <git@innay.de>
2021-02-18 22:25:52 +01:00
David Mehren
910f634b5f
Merge pull request #710 from hedgedoc/docs/toolbar
added interface documentation for the toolbar
2021-02-18 20:49:17 +01:00
David Mehren
cb339297c9
Merge pull request #924 from hedgedoc/renovate/develop-nestjs-packages
Update dependency @nestjs/cli to v7.5.5 (develop)
2021-02-18 20:48:46 +01:00
Renovate Bot
c9ae443dda
Update dependency @nestjs/cli to v7.5.5
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-17 09:08:29 +00:00
David Mehren
3c565501ed
Merge pull request #915 from hedgedoc/renovate/develop-lock-file-maintenance
Lock file maintenance (develop)
2021-02-16 22:46:22 +01:00
Renovate Bot
51e83392f5
Lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-16 21:43:40 +00:00
David Mehren
669688c12f
Merge pull request #847 from hedgedoc/test/authServiceUnitRewrite
Tests: Rewrote AuthService unit test
2021-02-16 22:29:14 +01:00
Philip Molares
680ca4188f Tests: Rewrote AuthService unit test
The unit test now uses per test mocking of the necessary functions instead of one mock in the beforeEach call.
Also some tests got expanded to cover more error cases.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-16 22:25:37 +01:00
David Mehren
39a09533bb
Merge pull request #922 from hedgedoc/renovate/develop-pin-dependencies
Pin dependency nest-router to 1.0.9 (develop)
2021-02-16 22:23:02 +01:00
Renovate Bot
215c47dcf9
Pin dependency nest-router to 1.0.9
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-16 21:07:58 +00:00