Added the OICD user object of the logged in user to route request functions.
@sakl This add the user
to the argument passed to the request
functions. The user is an object from the OICD library that we are using. I think the user id should be user.profile.sub
.
Please have a look at this MR and merge if you're happy with it.
However, I am not sure if you want to implement the "my groups" function this way. Especially if you would like to add a filter for arbitrary users later on. Wouldn't it make more sense to use a user_id
search parameter that you add when the user checks the "my groups" box? The value for this parameter can come from your page via useAuth
. If you want to have the box checked by default and therefore need the user_id
in the default search params, you can set the user_id
per default in the validateSearch
function of the route. The validateSearch
function now also receive the user
key in their arguments, similar to request
. Something like this:
validateSearch: ({rawSearch, user, ...params}) => ({
...validatePaginationSearch({rawSearch, ...params}),
user_id: rawSearch.user_id || user?.profile.sub
}),
request: ({search}) => ({
m_request: {
pagination: createPaginationRequest(search),
query: {
user_id: search.user_id
},
}
})