[HLAPI] Expanded permission checks #19678
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist before requesting a review
Description
This will address the last major blocker, AFIAK, with the new API for the stable GLPI 11 release.
Expand permission checks and some GraphQL handling:
Search
level instead of a middleware to account for permissions on indirectly requested itemtypes (GraphQL). For example this query is requesting Computers as the main itemtype, but also States which have different permissions:null
values at incorrect levels when missing permissions.visibilities
.x-rights-critieria['read']
, we know the user cannot view any of that itemtype so we can avoid querying the DB completely. This avoids sending a query with a condition like "1=0" which will resolve as false and return nothing anyways.This was originally waiting for another PR which may have reduced duplication on the SQL criteria between the new API and the search engine but that is a complex thing to make generic enough, notably with the different table aliases being used, and it is too late to continue that work for GLPI 11.0.