Commit Graph

175 Commits

Author SHA1 Message Date
Rijk van Zanten
6d698d1a7b Fixed issue that would cause uploads to the root folder of the file library to fail (#6348)
fixes #6310
2021-06-17 11:02:13 -04:00
Rijk van Zanten
4cb8d1f814 Add additional check to Two-Factor Authentication (by @masterwendu) (#6187)
* 6113 add tfa generate endpoint

* 6113 implement tfa otp check in user settings

* 6113 add autfocus for otp field on login form

* update package-lock

* improve TFA uri with user email

* fix vue 3 compatibility

* reduce code duplication for enableTFA

* Remove unnecessary parameters

* Use project name in otp url when available

* Update docs/reference/api/system/users.md

Co-authored-by: Wendelin Peleska <wendu@pm.me>
2021-06-10 15:36:34 -04:00
Rijk van Zanten
68add053b7 Fixed issue that would prevent the corresponding o2m field from being created on m2o relational setup (#6060)
Fixes #6009
2021-06-03 23:56:22 -04:00
Rijk van Zanten
77e00b7db4 Don't initialize database on file require (#6003) 2021-06-02 11:41:42 -04:00
Rijk van Zanten
9335372400 Foreign Key Constraints (#5615)
* Bump knex-schema-inspector

* Fix cli role name attr

* Update relation type

* Restructure relations

* Restructure relations table

* Update api type for relation record

* Fetch relations in new structure

* Update schema-inspector

* Use new relations schema structure in api

* Update relations GETters

* Add default value to one deselect

* Add create relationship on existing field

* Add updating existing relationship

* Add delete relations

* Add relations query resolver

* Add graphql mutations for relations

* Fix reading from wrong name

* Fix wrong method name

* No idea why this flip flops every install

* Update relation type

* Accept null in use-collection composable

* Use new relations structure in translations

* Use new relations structure in new-collection

* Start updating field detail store

* Renames for new relations structure

* Silently ignore passed collection/field in relation update

* Fix setting pk field in m2o relational setup

* Small tweaks in o2m setup

* Fix m2m setup

* Tweak m2o setup

* Fix m2a setup

* Allow null for related collection (m2a)

* Fix languages code name

* Fix migration default value

* Fix relational cleanup in collections/fields

* Fix transaction problem in field delete

* Fix inserting relational o2m items

* Don't execute updateByQuery on empty item set

Fixes #5710, fixes #5070

* Show referential action input on m2o

* Finish language for m2o

* Show triggers config on o2m

* Delete items on one_deselect_item delete

* Fix naming, show relational trigger config on m2m

* Tweak language, add setup to m2a

* Fix linter warnings

* Add trigger setup for translations

* fix Edit non-schema relationship issue

* Sync existing on_delete triggers in o2m setup

* Add migration to setup foreign key constraints

* Update illegal FK values before setting constraint

* Fix MySQL unsigned vs not-unsigned in FK creation

* Use pretty names for labels in relational triggers

* Prefix auto-junction when system table

Fixes #5493

* Add system foreign key triggers

Fixes #5749

* Update docs
2021-05-19 12:29:16 -04:00
rijkvanzanten
b84d3be981 Use items service directly instead of super
Fixes callstack order problem, fixes #5538 pt 2
2021-05-17 11:50:48 -04:00
José Varela
4d242ab5bf api: pass user object to auth hooks (#5251)
* api: pass user object to auth hooks
The motivation for this is the ability to migrate from
bcrypt passwords to argon2 seamlessly.

Fixes #4718
Fixes #4335

* receive user from `auth.login.before` hook

* pass `otp` as well on `auth.login` hooks

* api: last registered hook should have priority
When registering multiple hooks for a single event,
the last hook should have priority on return value.

* Fix linter warning

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-05-14 12:33:51 -04:00
Rijk van Zanten
9ac9a8d44b Add JSON/CSV Import (#5660)
* Add async/destroy packages

* Target node 12+

* Return payload data in json export

* Import JSON from Stream

* Add CSV import support

* Add CSV Import

* Add docs

* Add missing types
2021-05-14 11:03:12 -04:00
Pascal Jufer
44ffd60174 Add missing cookie options to cookie cleanup on logout (#5626) 2021-05-12 12:34:58 -04:00
Rijk van Zanten
a3898fa321 Add SESSION_STORE options (#5403)
* Allow configuring the session storage driver

Fixes #3814

* Document SESSION_STORE env var

* Add missing dependency

* Docs tweak
2021-04-30 18:18:39 -04:00
rijkvanzanten
74861e6f81 Add default display template for directus_files
Fixes #5364
2021-04-29 20:40:52 -04:00
rijkvanzanten
cd565c2e60 Fix patch handler of rest /folders
Fixes #5351
2021-04-29 20:16:52 -04:00
rijkvanzanten
801e868554 Fix remaining eslint errors
h/t @paescuj
2021-04-29 15:55:12 -04:00
Pascal Jufer
acd41eb0be Syntax fixes (#5367)
* Declare return types on functions

And a very few other type related minor fixes

* Minor syntax fixes

* Remove unnecessary escape chars in regexes
* Remove unnecessary awaits
* Replace deprecated req.connection with req.socket
* Replace deprecated upload with uploadOne
* Remove unnecessary eslint-disable-next-line comments
* Comment empty functions / catch or finally clauses
* Fix irregular whitespaces
* Add missing returns (null)
* Remove unreachable code
* A few logical fixes
* Remove / Handle non-null assertions which are certainly unnecessary (e.g. in
tests)
2021-04-29 12:11:43 -04:00
rijkvanzanten
c3c1337346 Ignore file extensions in assets endpoint path
Fixes #4067
2021-04-27 12:10:34 -04:00
rijkvanzanten
cb4bf88e66 Tweak relational interfaces
Squashed commit of the following:

commit ade7ce72e7dac9908504eacf420875baaae1cc47
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 13:16:03 2021 -0400

    Add no-items notice

commit e47dd5ac1f28300a33478a2be3c50496859b09fc
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 13:13:58 2021 -0400

    Remove files interface

commit 2925fb9c86719c48006f7b2619df7fd26bf7b523
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 13:10:44 2021 -0400

    Fix sort field in m2m

commit 009e2b1fd99f7a31f20fba04cd9980eaa3566ac8
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 13:06:45 2021 -0400

    Add dense at item count

commit 83b088f4da3ea4a1d7e030f34a07aa1cb2235b43
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 12:05:40 2021 -0400

    Tweak rendering of thumbnails inside relational interfaces

commit 06770a0f16e344ab62c0228b87824a6c00ad39bc
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 11:36:07 2021 -0400

    Rename $file->$thumbnail, render properly in render-template

commit 954fd725629ce055459a7925be4aaddf3fb723c2
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 11:35:53 2021 -0400

    Fix injection on v-field-select

commit 83073dea2fc26af61a5155adddd5d4e3afa5cb14
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 11:35:39 2021 -0400

    Adjust for virtual $thumbnail field on files

commit ee57b8316479204c0a5c931c86807afde55423a1
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 10:49:35 2021 -0400

    Don't hardcode file/user relations

commit 31ed92c5a785f20b7dc58bb62f35f6e31c95cfc6
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 10:49:22 2021 -0400

    Allow injecting temporary fields in field template

commit 9d98d4fe4def7bdba12d1613bd08bdb9bd9e1431
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 10:36:53 2021 -0400

    Render collection level template in placeholder

commit 0e0dda1e9f5a930ce3c73c2f8003d98853d58bc0
Merge: 65fa8084f 1e3b64bf9
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 10:35:21 2021 -0400

    Merge branch 'main' into relational-tweaks

commit 65fa8084f84aa1a90686fe6407a6d54ca47d1371
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 10:29:03 2021 -0400

    Make input container relative

commit 0674a0a00faa5df2208b466114721ba5d5116bf7
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 10:28:44 2021 -0400

    Add placeholder option to v-field-template
2021-04-22 13:16:20 -04:00
rijkvanzanten
1e3b64bf99 Fix upsert of collections meta 2021-04-22 10:28:27 -04:00
Rijk van Zanten
b40c62d257 Add support for SEARCH method (#5183)
* Add search method support for advanced get

* Add docs for SEARCH
2021-04-21 13:35:16 -04:00
Pascal Jufer
c82d0b4198 Remove refresh token cookie on logout (#5182)
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2021-04-21 16:53:11 +00:00
Rijk van Zanten
3b05372713 Finalize services API (#5170)
* Start the xOne/xMany work

* Update update/upsert

* Finish updating itemsservice

* Add comments, add nested revisions on update

* Use new internal api

* Update collectionService to one/many structure

* Move files to one/many structure

* Move permissions to one/many structure

* Move relations service to one/many structure

* Move roles to one/many structure

* Move users service over

* Move webhooks to updated structure

* Move deprecated methods to the bottom

* Replace deprecated uses

* Use new methods in controllers, add batch update/delete by query

* Use updated methods in API

* Fix email being required

* Remove unnecessary DB call

* Fix batch update/delete validation
2021-04-20 18:06:27 -04:00
rijkvanzanten
423279f5c0 Fix asset cache control header being in ms
Fixes #5160
2021-04-20 17:23:43 -04:00
Pyll Gomez
c3ef71298c Add oauth hook (#5045)
* Rotate JPG image on upload #4206

* fixes #3949 width/height generated for gif and tif

* API hooks for event added for auth.login #4079

* updated doc for api hooks for new auth.login event

* Style tweaks

* Update docs

* Tweak docs some more

* Spelling error

* Allow non-required flags and pass to hook

* SDK - Persistent login refresh fixes #4113

* Fixed #4145 SDK, Token Expired error

* Spell check

* Docs Spell check

* Docs Spell check

* Docs Spell check

* update docs for sdk-js

* To delete all expired session from db on login

* corrected the condition for the delete

* changed the from Date.now to new date .

* Move it inline

* Fixes #4653

* added docs and cleaned up the hooks payload

* use req.accountability

* added req.params.provider to payload

* provide scope for login

* docs updated for oauth hook

* Update api/src/controllers/auth.ts

* updated provider to redirect and docs

* added payload

* Make schema available in redirect hook

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-04-16 15:51:15 +00:00
Tomáš Petržela
07b85b7eb7 Global cookie parser (#5071)
* removed local cookie parser

* add global cookie parser

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2021-04-15 14:55:07 +00:00
Rijk van Zanten
1b1e500ee9 Make user email case insensitive (#4941) 2021-04-09 12:33:31 -04:00
Pyll Gomez
48b287a5b8 Sso login issue 4570 (#4675)
* Rotate JPG image on upload #4206

* fixes #3949 width/height generated for gif and tif

* API hooks for event added for auth.login #4079

* updated doc for api hooks for new auth.login event

* Style tweaks

* Update docs

* Tweak docs some more

* Spelling error

* Allow non-required flags and pass to hook

* SDK - Persistent login refresh fixes #4113

* Fixed #4145 SDK, Token Expired error

* Spell check

* Docs Spell check

* Docs Spell check

* Docs Spell check

* update docs for sdk-js

* To delete all expired session from db on login

* corrected the condition for the delete

* changed the from Date.now to new date .

* Move it inline

* Fixes SSO redirect with Json error

* Remove dependency on qs

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-04-08 17:18:00 -04:00
Jakob
183af8dd64 Fix extension path wildcard (#4906) 2021-04-08 09:13:34 -04:00
rijkvanzanten
cdbd6e820b Tweak static handler path for extensions 2021-04-07 12:54:23 -04:00
Rijk van Zanten
dd551f3571 Add non-items system Resolvers (#4863)
* Add auth resolvers

* Add password request/reset

* Add up until file import

* Make revisions read only

* Add server resolvers

* Add utils

* Add schema resolvers for schema manipulation
2021-04-06 18:04:35 -04:00
Rijk van Zanten
f90c31b798 GraphQL 2.0 (#4625)
* Start on GraphQL "2.0", add methodnotallowed exceptoin

* Fix relative file pointer in peer dep

* [WIP] Add pre-filtered schema to SchemaOverview

* Use root schema as is, add reduce-schema util

* Use reduceSchema in the wild

* Base schema on local reduced schema

* Remove todo

* Use graphql-compose to build out schema

* Start restructuring resolvers

* Add create mutation

* Return boolean true for empty create mutation selections

* Add update mutation

* Add delete mutation

* Add system/items scoping

* Fix merge conflicts for real now

* Use system services, rename ids->keys

* Start on docs on mutations

* Updates to match main

* Add fetch-by-id

* Add one/many resolvers for mutations

* Check system collection rows for singleton

* Fix resolver extraction for single read

* Share delete return type

* Add comments

* Use collection root name for readable type

* Add specs endpoint for GraphQL SDL

* Update docs

* Add note on SDL spec

* Fix delete single example

* Remove package-lock

* Fix collection read scoping in non-read
2021-03-30 17:06:35 -04:00
Pyll Gomez
71c8c4cc2c Assets quality parameter #4557 (#4620)
* Rotate JPG image on upload #4206

* fixes #3949 width/height generated for gif and tif

* API hooks for event added for auth.login #4079

* updated doc for api hooks for new auth.login event

* Style tweaks

* Update docs

* Tweak docs some more

* Spelling error

* Allow non-required flags and pass to hook

* SDK - Persistent login refresh fixes #4113

* Fixed #4145 SDK, Token Expired error

* Spell check

* Docs Spell check

* Docs Spell check

* Docs Spell check

* update docs for sdk-js

* To delete all expired session from db on login

* corrected the condition for the delete

* changed the from Date.now to new date .

* Move it inline

* fixes issue 4557 for asset quality for thumbnail

* asset documentation is updated

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-03-22 20:08:44 -04:00
rijkvanzanten
914a02c6c2 Return HEAD requests with correct headers on /assets
Fixes #4578
2021-03-17 21:51:10 -04:00
Rijk van Zanten
2cdf18545e Remove support for CSV in PK param (#4514)
* Remove csv in pk param

Closes #3933

* Remove last uses of csv in route pk params in app
2021-03-12 18:06:35 -05:00
Evgeny Vlasov
76b31eda78 add cookie's domain to another endpoints (#4499) 2021-03-12 07:56:36 -05:00
rijkvanzanten
f3683c9cf7 Parse filter structure on validation step
Fixes #4446
2021-03-11 18:25:14 -05:00
Rijk van Zanten
b613ce1d18 Improve recursive filtering (#4493)
* Use lowercase chars only

* Fix join alias mapping

* Pass keys as array in delete

* Cleanup delete controller

* Don't catch unexpected errors
2021-03-11 17:56:04 -05:00
Evgeny Vlasov
7bd5dc5c9f Add env for cookie domain (#4490)
* Add env for cookie domain

* fix doc

Co-authored-by: Власов Евгений <yavlas12@mts.ru>
2021-03-11 14:10:15 -05:00
rijkvanzanten
e8222d2a28 Add reset_url allow list for password reset request 2021-03-08 13:48:59 -05:00
rijkvanzanten
ec436170a0 Fix file import for admins 2021-03-04 17:02:29 -05:00
rijkvanzanten
ba4810bac3 Prevent direct(us_) access through /items 2021-02-26 17:30:51 -05:00
rijkvanzanten
f2d8c9e5be Check file create permissions before fetching external file 2021-02-25 19:03:38 -05:00
rijkvanzanten
4cfa64e752 Fix outgoing headers in /graphql
Fixes #4264
2021-02-24 11:06:55 -05:00
Pyll Gomez
aeb4ec0472 API hooks for event added for auth.login (#4255)
* Rotate JPG image on upload #4206

* fixes #3949 width/height generated for gif and tif

* API hooks for event added for auth.login #4079

* updated doc for api hooks for new auth.login event

* Style tweaks

* Update docs

* Tweak docs some more

* Spelling error

* Allow non-required flags and pass to hook

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-02-24 10:37:13 -05:00
rijkvanzanten
3d33b9db55 Allow and ignore null schema in field update
Fixes #4254
2021-02-23 17:06:35 -05:00
rijkvanzanten
0233e56c88 Fix type check of refresh cookie secure env var
Fixes #4205
2021-02-22 11:14:39 -05:00
rijkvanzanten
f9685b0d4a Base content-length on stat instead of saved value 2021-02-18 13:33:03 -05:00
Rijk van Zanten
6661633031 Fetch all meta rows when retrieving collections (#4142) 2021-02-17 18:55:29 -05:00
Rijk van Zanten
b81cfe0a49 Implement byte-range requests on /assets (#4136)
Fixes #3640
2021-02-17 17:56:44 -05:00
rijkvanzanten
76f1a387c7 Throw error on reading forbidden collection
Ref #4043
2021-02-15 13:50:44 -05:00
Nitwel
953b141245 fix fields not updateable because type is null (#4061) 2021-02-15 12:01:26 -05:00
Rijk van Zanten
81fc8443df Don't wrap text in nav (#4035)
* Move v-list-item-text to v-text-overflow, use in tables

* Fix type issue
2021-02-12 16:39:17 -05:00