Role

Role

Source:
Role instances

Type Definitions

Role

Source:
Properties:
Name Type Description
sys Meta.Sys System metadata
name string
permissions object Permissions for application sections
policies object
toPlainObject() function Returns this Role as a plain JS object
See https://www.contentful.com/developers/docs/references/content-management-api/#/reference/roles/create-a-role

Methods

(static) delete() → {Promise}

Source:
Deletes this object on the server.
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 for the deletion. It contains no data, but the Promise error case should be handled.
Type
Promise

(static) update() → {Promise.<Role>}

Source:
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:
Object returned from the server with updated changes.
Type
Promise.<Role>