2.1.0 • Published 11 years ago

cabrel-hapi-stats v2.1.0

Weekly downloads
3
License
-
Repository
github
Last release
11 years ago

cabrel-hapi-acl

ACL plugin for Hapi

Options

  • tagprefix - String; Defaults to acl
  • request - String; Defaults to auth.credentials. Can be dot notation or a single string
  • tags - Array(String); Defaults to ['auditors', 'admins']
  • validation - Object
    • auditors - Object
      • auditor - Defaults to a boolean value (true)
    • admins - Object
      • admin - Defaults to a boolean value (true)

Example

This example expects the request to resolve request.auth.credentials to an object with the following:

{
    auditorFor: ['TEST1', 'TEST2'],
    adminFor: ['TEST3', 'TEST4']
}

The cooresponding plugin configuration:

{
  tagprefix: 'acl',
  request: 'auth.credentials',
  tags: ['auditors', 'admins'],
  validation: {
    'auditors': {
       'auditorFor':  ['TEST1', 'TEST2']
    },
    'admins': {
       'adminFor': ['TEST3', 'TEST4']
    }
  }
}

The plugin builds strings in the form of tagprefix + tags[n] and then searches request.route.tags for matching entries. If a match is found, a validation test happens where the request.auth.credentials is checked for auditorFor to contain either 'TEST1' or 'TEST2'

2.1.0

11 years ago

2.0.1

11 years ago

2.0.0

11 years ago

1.9.0

11 years ago

1.8.0

11 years ago

1.7.1

11 years ago

1.7.0

11 years ago

1.6.0

11 years ago

1.5.0

11 years ago

1.4.0

11 years ago

1.3.0

11 years ago

1.2.0

11 years ago

1.1.0

11 years ago

1.0.0

11 years ago