open-index/open-npm huggingface dataset:
npm package: @sungazer/role-auth
Description: Simple library to handle role-based authorization, works very well with Symfony's role system.
Latest version: 17.0.0

# @Sungazer/RoleAuth

Simple library to handle role-based authorization, works very well with Symfony's role system.

## Usage

Include RoleAuthModule in your AppModule

```typescript
import { RoleAuthModule } from '@sungazer/role-auth';
```
Then specify the role hierarchy structure.
```typescript
RoleAuthModule.forRoot({
      roles: {
        "ROLE_ADMIN": ["ROLE_USER","ROLE_OTHER_ROLE"],
        "ROLE_OTHER_ROLE": ["ROLE_USER"],
        "ROLE_USER": []
      }
    })
```

Finally, inject RoleAuthService in your components. When the user logs-in, set his or her roles using the `setAuthenticatedUserRoles` function. After that, you can check for a role by invoking the `isGranted` function from the RoleAuthService.