Comments (12)
Fascinating, that is however a separate issue i was debugging before the weekend. Am kinda wondering why that works for ya but let's keep this one on topic 😄
from directus.
It hits the same default query limit but these arrays are much smaller as a customer might only be part of like 10ish companies max so the limit is not an issue for me here
Yeah the 100 default was chosen as a "sensible default" (same as the max nesting limit) so im leaning towards this being intentional and needed some docs on the matter to make sure people know about it 🤔
from directus.
I have not found a way to remove the limit from the permissions using filter rules other than changing the QUERY_LIMIT_DEFAULT on the ENV file.
As you've found you can change this default limit using the QUERY_LIMIT_DEFAULT
environment variable or by providing a limit
(https://docs.directus.io/reference/query.html#limit) for either on the main collection or deep->_limit
(https://docs.directus.io/reference/query.html#deep) for relations as long as it is smaller than the QUERY_LIMIT_MAX
.
The App itself should paginate where possible, Is the issue here that pagination is missing somewhere?
Closing the issue for now as the limit itself is by design.
from directus.
Hi @br41nslug
The issue is in the permissions checks themselves for the role. I know how to change the limit when using the API
api/src/services/permissions/index.ts
extends ItemsService
, which is bound by the default query limit, for permissions should this not check all instead of being limited? if it was by design I will just change the QUERY_LIMIT_DEFAULT
variable. I understand the limit for the API but for custom permissions it should probably check all or document somewhere that it will only check the first default query limit of relations.
I will try out the deep limits on the permissions, thanks for responding
from directus.
Ah hate to say it but that second rule ID is on of [<large array>]
(*note the nested array) wont work either way 😬
So the core issue is relational values gotten via dynamic variables $current_user.something
is hitting the default limit 🤔 I am torn between that being intentional or not as loading in 100+ item for each permission check aint great for performance.
from directus.
I increased the QUERY_LIMIT_DEFAULT
to 250 and gives the expected results based on the second rule.
from directus.
I increased the QUERY_LIMIT_DEFAULT to 250 and gives the expected results based on the second rule.
Interesting, maybe that only applies to m2m relations then, fascinating 🤔
from directus.
I am torn between that being intentional or not as loading in 100+ item for each permission check aint great for performance.
I thought this might have been an intentional design choice based on performance but was not sure, I could not find it documented somewhere that permissions would check based on the default query limit.
from directus.
I increased the QUERY_LIMIT_DEFAULT to 250 and gives the expected results based on the second rule.
Interesting, maybe that only applies to m2m relations then, fascinating 🤔
for M2M relations I have found this to work for nested arrays
{
"_and": [
{
"_or": [
{
"customer": {
"id": {
"_in": [
"$CURRENT_USER.customers"
]
}
}
},
{
"customer": {
"id": {
"_in": [
"$CURRENT_USER.companies.customer_id"
]
}
}
}
]
}
]
}
It hits the same default query limit but these arrays are much smaller as a customer might only be part of like 10ish companies max so the limit is not an issue for me here
from directus.
Thanks for responding,
I think it might need to be mentioned somewhere here configure-custom-permissions so others don't fall into the same trap, I first thought it was my permissions but if they were wrong the user would have seen nothing and not 100 items so then I looked at the source code of the Permissions Service I saw it extended the ItemService so figured it was hitting default query limit.
from directus.
Re-opening as issue for documentation to make sure it doesnt get forgotten 😄
from directus.
@br41nslug much appreciated, if you would like to discuss my M2M permissions setup for your other debugging issue I would be happy to send you the schema on discord DM if it helps out your debugging for M2M permissions.
from directus.
Related Issues (20)
- [SDK] Custom Storage configuration sometimes causes errors
- Permission inconsitency HOT 1
- Permissions error when using pg_restore HOT 5
- Environment variables: AUTH_<PROVIDER>_FIRST_NAME_KEY and AUTH_<PROVIDER>_LAST_NAME_KEY do not work HOT 2
- ERRNO 1 : SQLITE error when trying to crop or edit an image. HOT 1
- ROUTE_NOT_FOUND - Verify a Registration HOT 4
- Cannot load extension bundle on windows after updating Directus from 10.8.3 to 10.11.1 HOT 2
- Implement `meta` support in the SDK
- TypeError : Invalid URL, when loading directus bundle extension in directus version 10.11.2 on windows HOT 5
- Setting a preset for all users isn't working properly.
- Upload file via API returns 204 and empty body
- M2M uses wrong relation if two M2M relations use the same junction table
- Unable to Promote Version HOT 1
- Showing a nice structured JSON in "Log to Console" Logs HOT 1
- Throw errors when present from sdk
- How to create or delete user by only admin approval HOT 1
- why I am use .with(staticToken('staticToken')) tip Invalid user credentials HOT 3
- Manual sorting in M2M interface table layout is not obvious HOT 2
- Graphql errors getting swallowed by the SDK
- Applying a schema does not seem to invalidate the schema cache HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from directus.