Commit Graph

1533 Commits

Author SHA1 Message Date
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
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
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
Rijk van Zanten
2bb350f14f Fix nested relational limit for m2o fetching (#12235)
Fixes #12134
2022-03-18 16:27:25 -04:00
ian
5068ca096b Add lock for system cache (#12017)
* Add lock for system cache

* Add lock when forcing a flush

* Simplify code

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-03-18 15:54:02 -04:00
Azri Kahar
e6e129615e fix M2O field deletion (#11538)
* fix M2O field deletion

* fix lint

* fix for MySQL

* Pull final dropColumn out of transaction

* Forget that, check for existing constraint before deleting it instead

* Fix lint warning in unrelated file

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-03-18 15:36:50 -04:00
Rijk van Zanten
1c3e94d830 Add new export experience (#12201)
* Use script setup

* Start on export dialog

* Use new system field interface, replace limit with numeric input

* Set placeholder

* Add sort config

* Use folder picker, correct layoutQuery use

* Add local download button

* Allow writing exports to file

* Add notification after export

* Fix sort config, use new export endpoint

* Setup notification hints

* Add information notice

* Fix local limit, cancel button

* Add (basic) docs for export functionality

* Fix json export file format

* Implement xml batch stitching

* Resolve review points
2022-03-17 15:43:45 -04:00
ian
a79290e4a2 Export authorization service (#12208) 2022-03-17 08:52:42 -04:00
Azri Kahar
eb75912833 add cdn domain in CSP directives for in app docs (#12193)
* add cdn domain in CSP directives for in app docs

* fix images & videos placeholder width
2022-03-16 10:30:50 -04:00
Rijk van Zanten
73e6a12b98 Allow configuring overrides for the openid-client (#12088)
Resolves #11951
2022-03-11 09:45:55 -05:00
Rijk van Zanten
c1d705f94a Make sure mysql error extraction won't error on slice (#12087)
Fixes #12061
2022-03-10 17:29:56 -05:00
ian
7c91aa4278 Fix deep relational offset (#12076)
* Add relational offset

* Add offset tests

* Update relational test to use id

* Undo url change
2022-03-10 09:14:18 -05:00
Rijk van Zanten
6da3f1ed50 Add support for import ip deny list (#12025)
* Add support for import ip deny list

* Fix typo
2022-03-07 18:09:08 -05:00
Rijk van Zanten
826404bcbe Default CORS to disabled (#12022)
* Default CORS to disabled

* Update docs to match
2022-03-07 21:05:02 +00:00
Rijk van Zanten
a8df6d9653 Allow configuring /assets endpoint CSP separately (#12020)
* Allow configuring CSP for /assets seperately

* Document assets-csp config

* Remove double header
2022-03-07 15:41:13 -05:00
Spencer Jones
469f6400b7 add --dry-run flag to schema apply CLI command (#12006)
Co-authored-by: Spencer Jones <sjones@morningconsult.com>
2022-03-07 17:52:02 +00:00
Azri Kahar
0cd084ce67 fix query limit -1 for o2m queries (#12011) 2022-03-07 11:03:03 -05:00
Rijk van Zanten
eec21d8d9a Add "items.sort" event (#11954)
* Adds the 'sort_updated' event emit after items are sorted

Signed-off-by: Mihovil Ilakovac <mihovil.ilakovac@gmail.com>

* Updates the event name to 'sort_update'. Docs.

Signed-off-by: Mihovil Ilakovac <mihovil.ilakovac@gmail.com>

* Updates the event name to `sort`

* Add item/to to hook, fix docs

Co-authored-by: Mihovil Ilakovac <mihovil.ilakovac@gmail.com>
2022-03-04 19:58:47 -05:00
Lukas Kimpel
2312a0e20d Add check for filterPath length when not having m2o/a2o relation in order to add nested filters (#11768)
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-03-05 00:40:11 +00:00
rijkvanzanten
7145dfcd5c Fix migration for CRDB 2022-03-04 19:34:14 -05:00
Rijk van Zanten
6a3eb823c3 Update base theme of the App (#11952)
* Add migration to remove default value from project_color

* Upgrade the default theme

* Do a pass over the header buttons

* Do another pass over --warning uses

* Little things

* Tweak smoke

* Use updated map

* Use dark system elements in dark mode

* Remove outdated files, update toasts

* Use correct delete button style for role

* Use primary for created point

* Tweak spacing in revisions section

* Use primary for sidebar sections

* Various color tweaks and changes

* Update base color palette

* Update "css reset" code

* Remove splashscreens, add default favicon

* Add primary highlight to datamodel page

* dark mode color update

* fix sign out hover color

* Does this help?!

* This fixes some loading issues

Fixes https://github.com/directus/directus/issues/10707

* Calculate default pretty background?

* Fix public view with logo

* Fix responsiveness of login page

* adjust notification group width to be equal

* Do an absolute pointless task that doesn't do anything

It was suggested that it could fix the stylelint error in tests, but alas

* Remove stylelint

Doesn't seem to play nice with script setup and other changes

Co-authored-by: Ben Haynes <ben@rngr.org>
2022-03-04 18:53:39 -05:00
Rijk van Zanten
eea9f45624 Add authenticate hook to implement custom auth checks against current request (#11942)
* Add "authenticate" filter hook that allows custom auth check

* Start on test

* Update Jest, restructure API tests, start implementing authenticate test

* Move access token verify to util function

* Ensure jest can show inline warnings on correct lines

* Update is-directus-jwt to use jsonwebtoken decode + add tests

* Remove unused package

* Tweak and finish + test authenticate

* Tweak test

* Add authenticate filter to docs

* Don't scan tests for codeql

* No seriously, ignore tests
2022-03-03 16:29:13 -05:00
Azri Kahar
dec85f5659 add style to links in notice (#11925)
* add style to links in notice

* fix for stylelint

* unrelated: fix eslint warning for unused variables
2022-03-03 09:56:38 -05:00
Rijk van Zanten
962af79dbc Replace union query approach with updated table scan (#11246)
* Start by stripping out the previous Union attempt

* Then set limit to -1, causing massive memory issues on big data sets

* Now fix the memory problem by batching the responses

* Use env var for max relational batch size

* Rename env var, add to docs
2022-03-01 18:20:00 -05:00