# Persist user request

When the client make request to one service and inside the hook of the service you want to fetch data from another service you can persist user and provider to keep the user abilities<br>

#### Example of use from hook:

```javascript
const {callingParamsPersistUser} = require('feathers-mongoose-casl')

// Inside some hook
hooks({
    before: {
      get: [
        async function(hook){
        const productService =  hook.app.service('products');
        const product = await productService.find(callingParamsPersistUser(hook.params,{query: {'color': 'red'}}))
        };
})
```

### Example of use from class:

```javascript
  async find (params) {
        const productService =  hook.app.service('products');
        const product = await productService.find(callingParamsPersistUser(params,{query: {'color': 'red'}}))
  }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://feathersjs-mongoose.gitbook.io/feathers-mongoose-casl/version-2-support-feathers-4/docs/utils/persist-user-request.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
