Core
Framework v2.x
2

roles() #

Available since 2.14.0

Loads roles into the app.

This method is idempotent. If a role is defined multiple times, only the last definition will be retained.

This method can only be used before the application is started.

Copied to clipboard!
roles(roles: JSONObject): void

Argument Type Description
roles
JSONObject
Object containing roles and their definitions.

Usage #

Copied to clipboard!
app.import.roles({
  roleA: {
    controllers: {
      controllerA: {
        actions: {
          actionA: true,
          actionB: false,
        }
      },
      controllerB: {
        actions: {
          '*': true
        }
      },
    }
  },
  roleB: {
    controllers: {
      '*': {
        actions: {
          '*': true
        }
      }
    },
  },
})