Commit graph

1288 commits

Author SHA1 Message Date
renovate[bot]
6372ed7dfd
chore(deps): update dependency @types/node to v16.11.11 (#1862)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-04 03:38:06 +00:00
Philip Molares
10b5b11269
feat: replace GetNotePipe with GetNoteInterceptor and RequestNote
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-30 22:33:20 +01:00
Philip Molares
5a45ff2d0b
feat: add request note decorator
This extracts the note inserted with the get note interceptor into the request to be used by the controller service.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-30 22:26:55 +01:00
Philip Molares
470b32ed5e
feat: refactor get note pipe to interceptor
This is necessary, because of the order of operations in nestjs, the validation pipe is not able to get the note as the noteIdOrAlias will be transformed by the get note pipe after the validation did run.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-30 22:20:49 +01:00
Philip Molares
0cb3b65998
test: fix note e2e test 'fails with non-existing alias'
Because the rejection now happens automatically in the permissions guard it does not get to the controller method and does not report the Content-Type to text/markdown

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-21 18:04:47 +01:00
Philip Molares
988909eb0b
test: fix note e2e test 'fails, when user can't read note'
Because the rejection now happens automatically in the permissions guard it now returns a 403 instead of 401

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-21 18:03:29 +01:00
Philip Molares
3e4abb561d
refactor: move permissions service calls into permissions guard
This commit removes all previous calls to the permissions service at the beginning of the controller methods to the permissions guard. This should make the code a bit cleaner and remove boilerplate code.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-21 17:19:57 +01:00
Philip Molares
3b92226bab
feat: create permissions guard
This guard protects resources and let's users only access them if they hold the correct permission

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-21 17:18:23 +01:00
Philip Molares
7404ebf5ea
feat: create permission decorator
This gathers the permission a user needs to hold to access a resource for the PermissionsGuard.

See https://docs.nestjs.com/guards#setting-roles-per-handler

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-21 17:17:33 +01:00
Philip Molares
4a7ccc8178
feat: create permission enum
This enum makes it possible which permissions a user needs to hold to access a specific resource

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-21 17:16:12 +01:00
Philip Molares
82643cd790
chore: extract getNote code from GetNotePipe.transform
This was done so the same code could be used in the PermissionsGuard

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-21 17:12:35 +01:00
Philip Molares
7927ac2217
chore: move get-note-pipe to api utils
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-21 17:05:27 +01:00
Yannick Bungers
9093e5fabc
Add missing null in type in permissions service
The parameters of the permission checking methods were missing a null value for not set user. This is the case if user is not logged in and operating as guest.

Signed-off-by: Yannick Bungers <git@innay.de>
2021-11-29 22:42:31 +01:00
Renovate Bot
fdddedf6b3
fix(deps): update dependency passport to v0.5.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-11-21 23:20:49 +00:00
Renovate Bot
02eef978b3
chore(deps): update linters
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-11-23 07:50:47 +00:00
Renovate Bot
c49fb069ab
fix(deps): update dependency class-transformer to v0.5.1
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-11-22 19:53:40 +00:00
Renovate Bot
7ff54b1c3f
chore(deps): update dependency tsconfig-paths to v3.12.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-11-21 23:20:22 +00:00
Philip Molares
e9fab8c568
test: fix test name in alias.e2e-spec.ts
This seems to be a copy/paste bug

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-21 18:06:41 +01:00
renovate[bot]
fdb4ac3af3
fix(deps): update dependency minio to v7.0.20 (#1842)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-21 01:15:29 +00:00
Renovate Bot
453431282b
chore(deps): update dependency typescript to v4.5.2
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-11-20 15:08:40 +00:00
renovate[bot]
33332808c4
fix(deps): update dependency class-validator to v0.13.2 (#1839)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-20 15:05:49 +00:00
renovate[bot]
3958a4ac05
fix(deps): update dependency typeorm to v0.2.41 (#1836)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-20 12:20:22 +00:00
renovate[bot]
9eeb6ab152
chore(deps): update nestjs packages (#1835)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-20 10:40:44 +00:00
renovate[bot]
bf1567614e
chore(deps): update dependency source-map-support to v0.5.21 (#1834)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-20 08:38:19 +00:00
renovate[bot]
b9feed1811
chore(deps): update dependency @types/node to v16.11.9 (#1833)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-20 04:10:49 +00:00
renovate[bot]
b59340831d
chore(deps): update dependency @types/jest to v27.0.3 (#1832)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-20 02:13:10 +00:00
Renovate Bot
321d545907
chore(deps): update linters to v5.4.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-11-17 08:34:13 +00:00
David Mehren
bc2bef913f
ci(renovate): separate major updates
Signed-off-by: David Mehren <git@herrmehren.de>
2021-11-16 18:01:48 +01:00
David Mehren
803685fd3f
ci(renovate): run only on weekends
Signed-off-by: David Mehren <git@herrmehren.de>
2021-11-16 17:59:02 +01:00
David Mehren
8b4e4b86f2
ci(renovate): remove explicit dependencyDashboard
The `config:base` preset now includes this option

Signed-off-by: David Mehren <git@herrmehren.de>
2021-11-16 17:55:15 +01:00
renovate[bot]
88fe0f9c0c
fix(deps): update dependency raw-body to v2.4.2 (#1828)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-17 05:38:10 +00:00
David Mehren
7ef380241d
fix(seed): fix create method usage
Signed-off-by: David Mehren <git@herrmehren.de>
2021-11-14 21:49:31 +01:00
David Mehren
b9d3c95d2d
fix(note): fix type for owner param
To make the create method easier to use in conjunction
with the authentication framework, this commit changes the type of
the `owner` parameter from `User | undefined` to `User | null`.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-11-14 21:44:59 +01:00
David Mehren
c675dd0e9e
fix(alias): remove default for primary
To make the create method more consistent with the
guidelines,
this commit removes the default value from the `primary` parameter.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-11-14 21:22:22 +01:00
David Mehren
04412826a7
fix(media-upload): remove backendData parameter
`Create` methods should only contain optional properties

Signed-off-by: David Mehren <git@herrmehren.de>
2021-11-14 21:14:03 +01:00
David Mehren
3fe1bb0edf
fix(identity): remove default for syncSource
To make the create method more consistent with the
guidelines,
this commit removes the default value from the `syncSource` parameter.

An Identity will be created as sync source,
when the associated account is created using an external provider.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-11-14 20:56:17 +01:00
David Mehren
178513a3a0
fix(group): add special flag to create method
To make the create method more consistent with the
guidelines, this commit adds the `special` flag to
the parameters.
As this function will only be used to create the two hard-coded groups
and to handle API requests at one or two places, adding the parameter
should not be too problematic.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-11-14 20:53:45 +01:00
Philip Molares
d0239f3a24
docs: add dev documentation for create methods
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-11 22:07:00 +01:00
Philip Molares
62037acc97
fix(media-upload): rework create and media services saveFile
This was done to make the create method more concise.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-11 22:06:30 +01:00
Philip Molares
ed5367d456
test(private-api): fix aliases expect
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-11-08 21:40:36 +01:00
Philip Molares
b1d4696895
fix: the tests use the new typing from create methods
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-09-25 11:55:35 +02:00
Philip Molares
8cda5f99fb
fix: services use the new typings from create methods
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-09-25 11:52:42 +02:00
Philip Molares
d0b8e4cd36
feat: consolidate entities create
This was done to give better typings to the function signatures of entities `create` methods.
It also ensures that each field that should be set to `null` is set to `null` and doesn't leave that up to the typeorm handlers.

See: #1641
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-09-25 11:50:28 +02:00
David Mehren
bd902e50d1
test(jest): run e2e tests concurrently
Fixes #1644

Signed-off-by: David Mehren <git@herrmehren.de>
2021-11-16 18:26:04 +01:00
David Mehren
d4b806bbf8
test(mockconfig): generate unique upload paths
This stops multiple concurrently running tests disturbing each other.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-11-16 18:25:00 +01:00
renovate[bot]
ffeff87171
fix(deps): update nestjs packages (#1824)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-16 14:01:19 +00:00
renovate[bot]
4ed67c472e
chore(deps): lock file maintenance (#1821)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-15 03:32:56 +00:00
David Mehren
7b68028a68
chore(deps): update @types/node to 16.11.7
Signed-off-by: David Mehren <git@herrmehren.de>
2021-11-14 19:30:22 +01:00
Renovate Bot
299be9af1e
chore(deps): update dependency pymdown-extensions to v9.1
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-11-14 17:38:06 +00:00
Renovate Bot
83224e4d10
fix(deps): update nestjs packages to v8.2.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-11-11 20:37:51 +00:00