Skip to content

Commit

Permalink
Enhance access query logic to handle user ID and name conditions more…
Browse files Browse the repository at this point in the history
… robustly
  • Loading branch information
arturoliduena committed Dec 3, 2024
1 parent 56f2e22 commit fee5a59
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ export function getAccessQuery({
should: [
{ term: { public: true } },
...(user
? [{ term: user.id ? { 'user.id': user.id } : { 'user.name': user.name } }]
? user.id
? [
{ term: { 'user.id': user.id } },
{
bool: {
must_not: { exists: { field: 'user.id' } },
must: { term: { 'user.name': user.name } },
},
},
]
: [{ term: { 'user.name': user.name } }]
: []),
],
minimum_should_match: 1,
Expand Down

0 comments on commit fee5a59

Please sign in to comment.