getRoles( )


Retrieves the member's roles.

The getRoles() function 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 your site's contacts if they are added to your site Members in your site's dashboard.
  • The APIs in CurrentMember are only partially functional when previewing your site. View a published version of your 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?