Commit Graph

2062 Commits

Author SHA1 Message Date
Azri Kahar
3fb81db1c9 Fix schema apply for CURRENT_TIMESTAMP default value (#12716)
* Fix schema apply for CURRENT_TIMESTAMP default val

* add typeof string check
2022-04-13 11:18:58 -04:00
Aiden Foxx
4654aefa66 Added "json" to acceptedEnvTypes (#12727) 2022-04-13 09:22:42 -04:00
Rijk van Zanten
f92fb0762f Return BigIntegers as Strings in GraphQL (#12688)
Fixes #12051
2022-04-11 16:57:21 -04:00
Rijk van Zanten
49f97dfdd4 Only add update_me permissions for logged in users (#12685)
Fixes #12256
2022-04-11 15:39:21 -04:00
rijkvanzanten
56963faca9 Default users last_access to readonly
Ref #12655
2022-04-11 15:19:18 -04:00
Rijk van Zanten
a117e5b65f Add count fn support to gql (#12684) 2022-04-11 14:58:32 -04:00
Azri Kahar
095e7665d4 add citext as a supported local type (#12670) 2022-04-11 12:24:03 -04:00
Rijk van Zanten
e3f3d7e3b2 Throw payload error when using file upload without providing a file (#12682)
* Throw error on file upload if the number of uploaded files is 0

Fixes #12678

* Add unit test

* Mock env

* Fix mocks
2022-04-11 12:04:45 -04:00
ian
18d872a003 Merge permission's validation only when not empty (#12615) 2022-04-07 09:11:32 -04:00
ian
68066eccb7 Remove UTC conversion from date, time and datetime fields (#10956)
* Remove UTC conversion from date, time and datetime fields

* Fix mysql / maria timestamps when not in UTC timezone

* Add sequential tests with node timezone change

* Increase connection attempt check

* Add error catching in tests flow setup

* Check for server connectivity

* Fix promises

* Fix timestamp inconsistencies

* Revert to previously used parseISO

* Ensure database and directus connection

* Add another timezone to test positive and negative GMT

* Set local server hostname to localhost

* Add tests for SQLite

* Use notNullable primary key

* Revert connection testing sleep duration

* Fix nested transactions on SQLite

* Increase MSSQL request timeout

* Add type override flag for SQLite

* Remove commented code

* Add type override flags for Oracle

* Updated test file path

* Increase test servers launch timeout

* Increase test servers launch timeout

* Update format of tests

* Fix typo

* Increase test timeout for CockroachDB

* Add type overrides when creating fields through collections service

* Remove time field type conversion for Oracle

* Update collections list in test

* Remove check for time field in Oracle

* Add missing continue...

* Remove database override

* Add note for SQLite

* Rename flags and extract shared util

* Abstract remaining DB specific checks

* Revert flags renaming except renaming of test files

* Use date helper to add field flag

* Move field date typecasting upstream

* Use timestamp helper for date-created and date-updated

* Fix tests

* Remove unused vars

* Add tests for date-created

* Increase connection attempt count

* Fix test for mariadb

* Increase allowable difference to account for delays

* Add tests for date-updated

* Fix tests again for mariadb

* Add date helpers post merge

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-04-06 16:15:22 -04:00
Rijk van Zanten
f9457f5bdf Upgrade sharp (#12609)
Fixes #12440
2022-04-06 12:11:17 -04:00
ian
307cef8f5e Add permissions check for relational field only if child has filter (#12549)
* Add permissions check for relational field only if child has filter

* Allow id field for actions such as update and delete

* Use primary key instead of id

* Add test
2022-04-06 11:30:50 -04:00
ian
c6736c4f19 Fix access to count(*) aggregation (#12607) 2022-04-06 11:14:51 -04:00
Azri Kahar
f7e651cbe3 Set includeProjectDefault default value to false (#12601) 2022-04-06 10:07:56 -04:00
Jay Cammarano
70f36ac3d3 When no header icon is chosen use the panel types's icon for the default header icon rather than hardcoding "insert_chart" (#12541)
* panelTypeInfo.icon default for header

* migration: +nullable, -defaultTo('insert_chart')

* Rename migration file, use helper to fix oracle etc

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-04-05 15:29:11 +00:00
Aiden Foxx
26f626d552 Flatmap the oauth profile so we can use sub-values (#12457) 2022-04-05 11:14:49 -04:00
Azri Kahar
93a0369b99 Fix snapshot output (#12579) 2022-04-05 10:51:23 -04:00
Wryn (yage) Wagner
0930c2df97 Safe Metadata Upload (#12511)
* [Related to #11292] Safe Metadata Upload
- Created FILE_METADATA_ALLOWLIST
- Added test library for `FilesService`

* Rename ALLOWLIST->ALLOW_LIST to be consistent with other env vars

* Make sure it still works for files without Exif

* Prevent breaking changes in metadata formatting

* Allow * for all

* Fix md sup

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-04-04 20:43:56 -04:00
Azri Kahar
d0b0818cca Return 401 status code for expired tokens (#12281)
* Refresh token when it's expired & retry request

* move refresh token interceptor in autoRefresh flag

* add TOKEN_EXPIRED exception

* update interceptor condition & fix autoRefreshJob

* update docs

* revert auth drivers changes

* remove unused imports

* undo sdk auth refresh changes
2022-04-04 09:23:28 -04:00
Aiden Foxx
4cb8e8f0ca Always try to rebind on healthcheck error (#12532)
* Always attempt rebind on LDAP healthcheck error

* Fix linting error

* Update api/src/auth/drivers/ldap.ts
2022-04-04 09:17:06 -04:00
rijkvanzanten
2a6db01c42 v9.8.0 2022-04-01 14:41:08 -04:00
Christian Rendl
0206a3d2cc Added default locale before login (#8196)
* Added default locale before login

* Use project_language as default language for new users

* Revert "Use project_language as default language for new users"

* Allow user's language field to be nullable; Use project_language whenever language is unset;

* Apply suggestions from code review

Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de>

* Make "Project Default" option in system-language interface configurable

* Set language only if user language is not null

* Introduced translation for project_language field; Use translation in system-language interface

* Set app language only from app.vue;
Included watcher to restore project_language if user's language is (re)set to null

* Removed .alter() in knex migration since it's not needed for changing default and breaks checks

* Reverted previous change in migration; .alter() is needed for changing column defaults

* Reverted migration to use .defaultTo(null) to set default value

* Update position of project language field in settings

* Fix cockroachdb test error in knex migration

* Fix cockroachdb test error in knex migration

* Apply migration fix also on oracle databases

* Apply changes from code review

* Rename migration to fix migration key error

* Move setLanguage calls to server.ts and hydrate.ts

Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de>
Co-authored-by: jaycammarano <jay.cammarano@gmail.com>
Co-authored-by: Christian Rendl <cr@mutor.at>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-04-01 14:30:56 -04:00
ian
8139b5b467 Fix filter permissions for relational fields (#12426)
* Fix filter permissions for relational fields

* Add tests for filtering of top level relational field with and without permissions on relational table

* Find read permission only

* Update test with more permissions
2022-04-01 14:20:44 -04:00
Rijk van Zanten
3307bed5fd Improve cache reliability in DDL operations (#12400)
* Add TTL to schema cache

* Clear caches on unexpected errors in DDL

* Consistent return value use

* Don't set a default value for schema ttl
2022-04-01 13:24:20 -04:00
Azri Kahar
60c18d6125 Cast input data for filters (#12514) 2022-04-01 10:54:55 -04:00
Rijk van Zanten
90f5b0a471 Add functions support to the app + add count function (#12488)
* Rename date functions to fn, add json_array_length for pg

* Add json count to mssql

* Add json array count support to other vendors

* Add UI for selecting API functions

* Make it not break

* Render functions in filter preview better

* Include functions in field altering

* Add schema access to database helper

* Allow filtering against o2m/m2m/m2a count

* Add data function execution helpers in utils

* Fix type issue

* Inject function results in validate step

* Render field keys with function names translated

* Allow selecting nested/functions in field validation step

* Make sure number comparisons are treated as numbers

* Add check if instanceof date when casting to a Number

* Prevent selecting foreign keys for junction sort (#12463)

* [SDK] Add further request options to `items` functions (#12503)

* add possibility to set further options to the request

* fix options type

* add typings to interface

* add test if headers are passed thourght

* create reusable options param

* set higher priority to options param

* Small stylistic cleanup

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Jürg Hunziker <juerg.hunziker@gmail.com>
2022-03-31 16:56:26 -04:00
Azri Kahar
fca1c8b699 Fix field validation not being cast as json (#12482) 2022-03-30 15:38:34 -04:00
Azri Kahar
31cfb8266f Bookmark improvements (#12031)
* add icon & color to bookmarks

* update current bookmark title on edit

* clean up edit bookmark dialog on cancel

* remove unused bookmark-edit component

* interaction improvements

* sort based on scope and alphabetically

* prevent hover when locked & use tooltip

* Reduce size of right hand icon in bookmark

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-03-28 11:23:00 -04:00
José Varela
a58f09114d App / Presets: Use layout-wrapper to list presets (#10978)
* Use layout-wrapper to list presets
Right now, it's not possible to pass a custom column to layout-wrapper. So the `Scope` is not available anymore, because it's a computed value and we do not support computed values as of the time being.

* update batch selection & button styles

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-03-28 09:45:40 -04:00
Rijk van Zanten
175fb849c4 Add field-level validation (#12363)
* Add field validation column

* Add frontend config for validation

* Make it work

* Add regex to filter configuration

* Fix const/let

* Add custom validation message support

* Add custom validation message tooltip inline

* Fix custom names in validation errors up top

* Fix type error

* Nog eentje om het af te leren

* resolve unused import warnings
2022-03-25 18:03:36 -04:00
rijkvanzanten
f012504c51 Force path part to string 2022-03-25 14:55:51 -04:00
Spencer Jones
7d391ed4fa fix: handle nulls when processing m2m (#12187)
fixes #12099

Co-authored-by: Spencer Jones <sjones@morningconsult.com>
2022-03-25 13:42:55 -04:00
CommanderRoot
d81adcd674 refactor: replace deprecated String.prototype.substr() (#12344)
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
2022-03-25 13:36:18 -04:00
Rijk van Zanten
caf698ed2f Use Url util to construct urls everywhere (#12394)
Fixes #12345
2022-03-25 13:21:59 -04:00
Azri Kahar
3cb64c477a Fix csv values from env variables in telemetry (#12370) 2022-03-25 12:40:56 -04:00
ian
998bdae567 Fix typecast migration array (#12372)
* Fix incorrect saving of field special in migration

* Add hotfix

* Run typecasting again just in case...

* Rename migration

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-03-25 10:35:42 -04:00
Rijk van Zanten
eafc4a6c69 Fix deep _limit -1 not resolving all items (#12385) 2022-03-25 09:55:37 -04:00
rijkvanzanten
1395e7d10c Use correct value in driver validation 2022-03-24 16:25:09 -04:00
Azri Kahar
ce0169d5c8 fix LOGGER_LEVELS array being split as string (#12342)
* fix LOGGER_LEVELS array being split as string

* use toArray

* some basic tests
2022-03-24 09:08:43 -04:00
Azri Kahar
577e803bb5 fix activity fields using invalid display (#12351) 2022-03-24 09:45:21 +00:00
Yasser Lahbibi
3b5fb27fdf fix: cast translation strings as json (#12349) 2022-03-24 17:35:03 +08:00
rijkvanzanten
7b15947276 v9.7.1 2022-03-23 14:50:51 -04:00
Rijk van Zanten
9435573742 Fix auto-casting of array like values in env (#12330) 2022-03-23 11:59:34 -04:00
Rijk van Zanten
de152d1995 Fix inconsistent delete action payload (#12328)
Fixes #12326
2022-03-23 10:40:16 -04:00
rijkvanzanten
3d795236da Remove confusing warning 2022-03-22 11:26:36 -04:00
Azri Kahar
37cbaa0be5 Add App Translation Strings in Settings (#12170)
* add migration for translation strings

* add to navigation

* WIP

* fix dialog overflow

* update translation keys

* Update logic

* add placeholder to system-language

* fix translation

* remove unused import

* reset dialog on create new

* ensure search input is visible when searching

* merge translation strings on set language

* merge translation strings on update

* hydrate

* make sure null translation do not get merged

* change dialog to drawer

* update placeholder text

* fix form value

* revert dialog style change

* rename drawer component

* Force safe key name

* Move interface to system interfaces

The saved values are Directus app proprietary, so to prevent confusion in what it's supposed to do, we'll move it to system.

* Move composable to root composables

* Use new languages input in interface/display options

* hide translation strings field in project settings

* set system true to system-input-translated-string

* use this in field detail notes

* use in list options

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-03-22 09:39:04 -04:00
ian
e2eb2801c5 Prefix existing field typecasting flags with "cast-" (#12141)
* Prefix typecasting field flags

* Fix payload test

* Update flags for system tables and for field creation in app

* Revert cast-hash and cast-uuid

* Rename migrations file to current date
2022-03-21 14:46:48 -04:00
ian
ff3c99961c Fix incorrect order of migrations when reverting (#12130) 2022-03-21 14:29:15 -04:00
ian
72180f7027 Add query filter validation with permissions (#12190)
* Add query filter validation with permissions

* Allow all fields in test

* Revert test and add check for permissions with empty fields

* Add check for deep filters

* Add tests

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-03-21 18:19:37 +00:00
rijkvanzanten
c1da41d671 v9.7.0 2022-03-18 16:34:35 -04:00