/auth
Search
K
Comment on page

addAssignedRole( )

SlashAuth allows developers to assign roles directly to a user at the app-level and the org-level. This function allows for role assignment directly to a user.

Usage

const { data } = await client.user.addAssignedRole({
userID: 'user.1234',
role: 'Super Admin',
});
console.log('User Level: ', data?.level.name);

Return Value

{
data?: {
type: UserRoleType;
level: {
name: string;
description?: string;
};
};
error: ErrorMessage | null;
headers: Object;
statusCode: number;
}

Configuration

userID

String that represents a user's ID.
const { data } = await client.user.addAssignedRole({
userID: 'user.1234',
role: 'Super Admin',
});
console.log('User Level: ', data?.level.name);

role

String that represents a role.
const { data } = await client.user.addAssignedRole({
userID: 'user.1234',
role: 'Super Admin',
});
console.log('User Level: ', data?.level.name);

organizationID (optional)

String that represents an organization's ID.
const { data } = await client.user.addAssignedRole({
userID: 'user.1234',
organizationID: 'org.abc',
role: 'Super Admin',
});
console.log('User Level: ', data?.level.name);