> For the complete documentation index, see [llms.txt](https://skyslit.gitbook.io/magicjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://skyslit.gitbook.io/magicjs/api-references/backend/utils/isuserinanyroles.md).

# isUserInAnyRoles()

This function is designed to check whether a user is assigned to any of the specified roles within a system. It provides a way to verify whether a user possesses at least one of the roles provided in the roles array.

> Here is an Example:

```typescript
import { createBackendFunction, utils } from "@magicjs.dev/backend"

export default createBackendFunction(
  async function (userId,roles) {
    const userIsInAdminRole = await utils.isUserInAnyRoles(String(userId), roles);
    return userIsInAdminRole
  },
)
```

[Click here to refer GitHub.](https://github.com/skyslit/magicjs.dev/blob/main/packages/backend/src/utils.ts#L62)
