Skip to content

New property (oneOf) in route permission object #160

Open
@dmielewczyk

Description

@dmielewczyk

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[x] Feature request
[ ] Documentation issue or request

Current behavior

Currently there is no property in permissions object to handle a case when we need to allow access user with PERMISSION_1 or PERMISSION_2.

Expected behavior

I would expect new property oneOf that will check if user has one of listed permissions. This property should work with other properties as well (only, except).

Example:

{
    path: 'test',
    component: TestComponent,
    canActivate: [NgxPermissionsGuard],
    data: {
      permissions: {
        only: 'POST_WRITER',
        oneOf: ['MODERATOR', 'REPORTER']
      }
    }
 }

NgxPermissionGuard should check it in following way: permissions.has('POST_WRITER') && (permissions.has('MODERATOR') || permissions.has('REPORTER'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions