Commit graph

603 commits

Author SHA1 Message Date
Philip Molares
87e2502c6e feat: add permission routes to private api
Co-authored-by: Erik Michelson <github@erik.michelson.eu>
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-09-11 20:08:24 +02:00
Philip Molares
eca22f5623 refactor(test): fix linting errors
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-08-29 02:47:12 +02:00
Philip Molares
ccacbd22b2 feat(private-api): add get note metadata call
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-08-28 13:02:33 +02:00
David Mehren
bbf7209c27 tests(test-setup): ensure shutdown hooks get run
Signed-off-by: David Mehren <git@herrmehren.de>
2022-08-07 22:45:25 +02:00
Tilman Vatteroth
4746c30c26 feat: persist notes on realtime note unload and on interval
The realtime note map has been moved into its own class
to separate the realtime note business logic from the storing logic.

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2022-08-07 22:45:25 +02:00
renovate[bot]
62be0ba3c0 fix(session-entity): update for connect-typeorm v2
Signed-off-by: David Mehren <git@herrmehren.de>
2022-08-02 08:59:37 +02:00
Tilman Vatteroth
ce29cc0a2e feat: add base implementation for realtime communication
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
Co-authored-by: Erik Michelson <github@erik.michelson.eu>
Co-authored-by: Philip Molares <philip.molares@udo.edu>
Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2022-07-10 19:46:03 +02:00
Tilman Vatteroth
d9ef44766d refactor: deduplicate code in history service unit test
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2022-07-10 19:46:03 +02:00
Tilman Vatteroth
57365bb727 refactor: move typeorm store into new session module
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2022-07-10 19:46:03 +02:00
Tilman Vatteroth
14ee7485ad refactor: remove unused dependency on note module in permissions module
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2022-07-10 19:46:03 +02:00
Tilman Vatteroth
8596bed729 refactor: remove cycling dependency between notes and revisions
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2022-07-10 19:46:03 +02:00
David Mehren
c9cc1e2fb7 refactor: extract common app setup code
This allows the E2E tests and the real app to share the same setup.

Fixes #2083

Signed-off-by: David Mehren <git@herrmehren.de>
2022-06-26 20:43:23 +02:00
Lautaro Alvarez
a0b5da6c8b refactor(media-apis): Implement a decorator to convert header to Note instance
Just find the related note in an Interceptor (in both public and private routes)

Related issue: https://github.com/hedgedoc/hedgedoc/issues/1594

Signed-off-by: Lautaro Alvarez <lautarolalvarez@gmail.com>
Signed-off-by: David Mehren <git@herrmehren.de>
2022-06-19 20:58:23 +02:00
David Mehren
06c39ea759 refactor: adapt for typeorm 0.3
Signed-off-by: David Mehren <git@herrmehren.de>
2022-06-12 20:09:07 +02:00
David Mehren
43d3f14322 Use new APIs in seed.ts
Signed-off-by: David Mehren <git@herrmehren.de>
2022-06-12 20:09:07 +02:00
David Mehren
d780d511cd fix(notes-service): user query builder
For reasons, the typeorm 0.3 broke the find()
method when using relations in the WHERE clause.
This replaces the find method with a query builder.

Signed-off-by: David Mehren <git@herrmehren.de>
2022-06-12 20:09:07 +02:00
David Mehren
27a93a2895 fix(media-service): user query builder
For reasons, the typeorm 0.3 broke the find()
method when using relations in the WHERE clause.
This replaces the find method with a query builder.

Signed-off-by: David Mehren <git@herrmehren.de>
2022-06-12 20:09:07 +02:00
David Mehren
3503a45078 fix(history-service): user query builder
For reasons, the typeorm 0.3 broke the find()
method when using relations in the WHERE clause.
This replaces the find method with a query builder.

Signed-off-by: David Mehren <git@herrmehren.de>
2022-06-12 20:09:07 +02:00
David Mehren
366aead689 fix(revisions-service: user query builder
For reasons, the typeorm 0.3 broke the find()
method when using relations in the WHERE clause.
This replaces the find method with a query builder.

Signed-off-by: David Mehren <git@herrmehren.de>
2022-06-12 20:09:07 +02:00
David Mehren
c4975e4783 refactor: adapt for typeorm 0.3
Signed-off-by: David Mehren <git@herrmehren.de>
2022-06-12 20:09:07 +02:00
David Mehren
d104a98f81 test(FrontendConfig): Remove loop over irrelevant variables
Some variables are not used in any logic,
so looping over them does not make any sense.

Signed-off-by: David Mehren <git@herrmehren.de>
2022-06-05 20:43:44 +02:00
David Mehren
f3cf4f4b1f test(FrontendConfig): Move getAuthProviders to own test
Signed-off-by: David Mehren <git@herrmehren.de>
2022-06-05 20:43:44 +02:00
David Mehren
1ac4258d07 fix(revision-service): fix count of duplicate authors
`getRevisionUserInfo` returned an incorrect list of usernames,
as users who edited a note at multiple places appeared multiple times.

 This commit fixes this behaviour by deduplicating the author
  objects using a Set.

  Closes #2180

Signed-off-by: David Mehren <git@herrmehren.de>
2022-05-22 23:13:04 +02:00
David Mehren
ec398eb160 feat: add logging for typeorm
Signed-off-by: David Mehren <git@herrmehren.de>
2022-05-01 20:49:09 +02:00
David Mehren
d3c6deffb4 feat(console-logger): allow to bring own colors
Signed-off-by: David Mehren <git@herrmehren.de>
2022-05-01 20:49:09 +02:00
David Mehren
b670702f41 feat: Use real database config for app
Signed-off-by: David Mehren <git@herrmehren.de>
2022-05-01 20:49:09 +02:00
David Mehren
cd5256da7f refactor(db-config): Use typeorm-style options
TypeORM does not use a separate config option for the path
to the SQLite file.
Additionally, the "dialect" is called "type."

This commit adjusts our config to follow the upstream convention
to reduce confusion.

Signed-off-by: David Mehren <git@herrmehren.de>
2022-05-01 20:49:09 +02:00
David Mehren
40c23acd49 test(notes-service): Add test for toNoteMetadataDto with no alias
Signed-off-by: David Mehren <git@herrmehren.de>
2022-05-01 20:23:33 +02:00
David Mehren
161329fa7c test(notes-service): Move mocking setup to common function
Signed-off-by: David Mehren <git@herrmehren.de>
2022-05-01 20:23:33 +02:00
Erik Michelson
ef0fdac18c fix(notes): primaryAddress reveals internal UUID
The primaryAddress field of a note contained the internal UUID of the note when no primary alias was defined instead of the public note id.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2022-04-18 11:02:53 +02:00
David Mehren
3cff7f861a fix(console-logger): don't sanitize colors away
2467b125 mistakenly applied the sanitize function
to the log messages *after* the color was applied.

This commit reverses the order to un-break colored logs.

Signed-off-by: David Mehren <git@herrmehren.de>
2022-04-17 21:51:03 +02:00
Philip Molares
b4e62c8425 feat: add ldap login to auth controller
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-04-17 21:05:13 +02:00
Philip Molares
82dd9f8885 feat: add ldap strategy
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-04-17 21:05:13 +02:00
Philip Molares
90d97689fd feat: add ldap support methods
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-04-17 21:05:13 +02:00
Philip Molares
174eee8f0a test: ldap auth config
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-04-17 21:05:13 +02:00
Philip Molares
6181e586bf fix: ldap auth config
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-04-17 21:05:13 +02:00
Philip Molares
98db69448c feat: add logging to local.strategy.ts
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-04-17 21:05:13 +02:00
Philip Molares
ec6e66b6a8 test: add authConfig tests for ldap
This tests the ldap part of the authConfig. Other tests shall be added as the auth method is implemented.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-04-17 21:05:13 +02:00
Philip Molares
91d7f1a529 fix: error in toArrayConfig
If an empty string or undefined is provided the method should not return [], but undefined instead. This way defaults defined in Joi function as expected.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-04-17 21:05:13 +02:00
Philip Molares
5db2229771 fix: error in replaceAuthErrorsWithEnvironmentVariables
The method should only change error messages if it was called with the correct parameters. Otherwise the function would change e.g `.url` in the error message to `_URL` and the regex is not able to change the front of the error message.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-04-17 21:05:13 +02:00
Philip Molares
87041f84ce test: test sanitize method
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-04-14 16:19:48 +02:00
Philip Molares
2467b1250f feat: add sanitization to logger service
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-04-14 16:19:48 +02:00
Yannick Bungers
a1fd52d8ab fix param description of updateNotePermissions
Signed-off-by: Yannick Bungers <git@innay.de>
2022-03-13 21:33:02 +01:00
Yannick Bungers
f096d706c8 optimize readability of find calls
Signed-off-by: Yannick Bungers <git@innay.de>
2022-03-13 21:33:02 +01:00
Yannick Bungers
70d7ca5475 Move permission update functions to permissions controller
Signed-off-by: Yannick Bungers <git@innay.de>
2022-03-13 21:33:02 +01:00
Yannick Bungers
4dd2762be2 Add unit tests for new notes service methods
setUserPermission
removeUserPermission
setGroupPermission
removeGroupPermission
changeOwner

Signed-off-by: Yannick Bungers <git@innay.de>
2022-03-13 21:33:02 +01:00
Yannick Bungers
0a3271e4a5 Add GroupsModule import to public API module
Signed-off-by: Yannick Bungers <git@innay.de>
2022-03-13 21:33:02 +01:00
Yannick Bungers
647990022b Add API routes for fine-grained permission manipulation
Signed-off-by: Yannick Bungers <git@innay.de>

fix lint

Signed-off-by: Yannick Bungers <git@innay.de>
2022-03-13 21:33:02 +01:00
Yannick Bungers
20ebb41197 Add service functions for fine-grained permission API calls
Signed-off-by: Yannick Bungers <git@innay.de>
2022-03-13 21:33:02 +01:00
David Mehren
3e096e9cbe fix(note-user-permission): ensure whole row gets deleted
By default, TypeORM wants to NULL the child-side of a
many-to-one relation, when the relation gets deleted.
This is not possible when the column is not nullable,
so the whole row needs to get deleted.

Signed-off-by: David Mehren <git@herrmehren.de>
2022-03-13 21:33:02 +01:00