Skip to main content

getUserRoles

A MoogDb v2 method that returns the roles of a user.

Back to MoogDb V2 API Method Reference.

Request arguments

Method getUserRoles takes the following request arguments:

Name

Type

Required

Description

userId

Number

No, if you use username.

A valid user ID.

username

String

No, if you use userId.

A valid username.

Response

Method getUserRoles returns the following response:

Type

Description

JSON Object

A JavaScript object containing the role IDs, role names and role descriptions for the specified user.

Examples

The following examples demonstrate typical use of method getUserRoles:

Request example

Example request to return the user roles for user ID 6:

var cevent = moogdb.getUserRoles(6);

Response example

Example response returning the roles of the specified user:

[{
    "id": 1,
    "name": "Super User",
    "description": "Super User"
},
{
    "id": 3,
    "name": "Manager",
    "description": "Manager"
}, 
{
    "id": 4,
    "name": "Operator",
    "description": "Operator"
}]