StackRoleMappings
StackRoleMappings
The StackRoleMappings methods allows you to retrieve, add, update and delete users from a team.
add
The add method adds an user to the team.
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
const addRole = {
stackApiKey: 'stackApiKey',
roles: ['role_uid']
}
client.organization('organizationUid').teams('teamUid').stackRoleMappings().add(addRole)
.then((response) => console.log(response))fetchAll
The fetchAll method allows you to fetch all details of the roles of that team.
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
client.organization('organizationUid').teams('teamUid').stackRoleMappings().fetchAll()
.then((response) => console.log(response))delete
The delete method deletes all roles of the stack.
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
client.organization('organization_uid').teams('teamUid').stackRoleMappings('stackApiKey').delete()
.then((response) => console.log(response)update
The update method is used to update the roles.
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
const updateRoles = {
roles: ['role_uid1', 'role_uid2']
}
client.organization('organizationUid').teams('teamUid').stackRoleMappings('stackApiKey').update(updateRoles)
.then((response) => console.log(response))