Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchParapheur
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchParapheur
Commits
d89ef36c
Commit
d89ef36c
authored
2 months ago
by
nicoutur
Browse files
Options
Downloads
Patches
Plain Diff
FIX #31828 TIME 2:20 Optimize search request with visibility restriction
parent
14fad48a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/search/controllers/SearchController.php
+15
-13
15 additions, 13 deletions
src/app/search/controllers/SearchController.php
with
15 additions
and
13 deletions
src/app/search/controllers/SearchController.php
+
15
−
13
View file @
d89ef36c
...
...
@@ -42,19 +42,21 @@ class SearchController
$baseRestriction
=
''
;
$baseData
=
[];
if
(
!
$hasFullRights
)
{
$baseRestriction
=
'
id IN
(
SELECT
DISTINCT ws1.main_document_id
$baseRestriction
=
'
EXISTS
(
SELECT
1
FROM workflows ws1
WHERE typist = ?
OR (ws1.process_date IS NOT NULL AND ws1.user_id = ?)
OR (
ws1.user_id IN (
SELECT (SELECT ?::int) UNION (SELECT id FROM users WHERE substitute = ?)
)
AND ws1."order" = (
SELECT min(ws2."order") FROM workflows ws2 WHERE ws2.process_date IS NULL AND ws2.main_document_id = ws1.main_document_id
)
)
LEFT JOIN users u ON ws1.user_id = u.id AND u.substitute = ?
LEFT JOIN (
SELECT main_document_id, MIN("order") AS min_order
FROM workflows
WHERE process_date IS NULL
GROUP BY main_document_id
) mo ON ws1.main_document_id = mo.main_document_id
WHERE ws1.main_document_id = main_documents.id
AND (main_documents.typist = ?
OR (ws1.process_date IS NOT NULL AND ws1.user_id = ?)
OR (ws1.user_id = ? OR u.id IS NOT NULL)
AND ws1."order" = mo.min_order)
)'
;
$baseData
=
[
$GLOBALS
[
'id'
],
$GLOBALS
[
'id'
],
$GLOBALS
[
'id'
],
$GLOBALS
[
'id'
]];
}
...
...
@@ -120,7 +122,7 @@ class SearchController
$where
[]
=
'id = ?'
;
$data
[]
=
$body
[
'documentId'
];
}
if
(
Validator
::
arrayType
()
->
each
(
Validator
::
in
([
'softDeleted'
,
'hardDeleted'
]))
->
notEmpty
()
->
validate
(
$body
[
'documentState'
]
??
null
))
{
$docStatesForQuery
=
[];
if
(
in_array
(
'softDeleted'
,
$body
[
'documentState'
]))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment