Core
Framework v2.x
2

profiles() #

Available since 2.14.0

Loads profiles into the app.

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

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

profiles(profiles: JSONObject): void

ArgumentTypeDescription
profiles
JSONObject
Object containing profiles and their definitions.

Usage #

app.import.profiles({
  profileA: {
    rateLimit: 50,
    policies: [
      {
        roleId: 'roleA'
      },
      {
        roleId: 'roleB',
        restrictedTo: [
          {
            index: 'index1'
          },
          {
            index: 'index2',
            collections: [ 'collectionA', 'collectionB']
          }
        ]
      }
    ]
  },
  profileB: {
    policies: [
      { roleId: 'roleA' }
    ]
  },
})