Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Role

Hierarchy

  • { description?: undefined | string; name: string; permissions: { ContentDelivery: string[] | string; ContentModel: string[]; EnvironmentAliases: string[] | string; Environments: string[] | string; Settings: string[] | string }; policies: { actions: ActionType[] | "all"; constraint: ConstraintType; effect: string }[]; sys: BasicMetaSysProps & { space: SysLink } }
  • DefaultElements<RoleProps>
    • Role

Index

Properties

Optional description

description: undefined | string

name

name: string

permissions

permissions: { ContentDelivery: string[] | string; ContentModel: string[]; EnvironmentAliases: string[] | string; Environments: string[] | string; Settings: string[] | string }

Permissions for application sections

Type declaration

  • ContentDelivery: string[] | string
  • ContentModel: string[]
  • EnvironmentAliases: string[] | string
  • Environments: string[] | string
  • Settings: string[] | string

policies

policies: { actions: ActionType[] | "all"; constraint: ConstraintType; effect: string }[]

sys

sys: BasicMetaSysProps & { space: SysLink }

Methods

delete

  • delete(): Promise<void>
  • Deletes this object on the server.

    memberof

    Role

    func

    delete

    example
    const contentful = require('contentful-management')
    
    const client = contentful.createClient({
      accessToken: '<content_management_api_key>'
    })
    
    client.getSpace('<space_id>')
    .then((space) => space.getRole('<role_id>'))
    .then((role) => role.delete())
    .then((role) => console.log(`role deleted.`))
    .catch(console.error)

    Returns Promise<void>

    Promise for the deletion. It contains no data, but the Promise error case should be handled.

toPlainObject

update

  • update(): Promise<Role>
  • Sends an update to the server with any changes made to the object's properties

    example
    const contentful = require('contentful-management')
    
    const client = contentful.createClient({
      accessToken: '<content_management_api_key>'
    })
    
    client.getSpace('<space_id>')
    .then((space) => space.getRole('<roles_id>'))
    .then((roles) => {
      roles.name = 'New role name'
      return roles.update()
    })
    .then((roles) => console.log(`roles ${roles.sys.id} updated.`))
    .catch(console.error)

    Returns Promise<Role>

    Object returned from the server with updated changes.