getRoles( )


Retrieves the member's roles.

getRoles() returns a Promise that resolves to the roles of the currently logged-in member. If no member is currently logged in, the Promise is rejected.

Notes:

  • The member data in the resolved promise will only include custom fields from a site's contacts if those fields are added to a site's members in a dashboard.
  • The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality.

The following results are returned depending on the session identity:

Session IdentityPromise Resolves To
Logged-in memberArray of member roles
Site owner or contributor with admin permissionsArray of member roles, plus an additional role where name is Admin
Anyone elsePromise is rejected
Method Declaration
Copy
Request
This method does not take any parameters
Returns
Return Type:Promise<Array<Role>>
Did this help?