共用方式為


Sys.Services RoleService roles Property

Gets the roles for the currently authenticated user.

Note

To get or set property values for client API properties, you must call property accessor methods that are named with the get_ and set_ prefixes. For example, to get or set a value for a property such as cancel, you call the get_cancel or set_cancel methods.

var roles = Sys.Services.RoleService.get_roles();

Return Value

An Array instance that contains the roles.

Remarks

Before you access the roles property, you must load the roles by using the load method. If you do not load the roles or if there are no roles defined, the returned array is empty.

Example

The following example shows how to use the roles property. This code is part of a complete example found in the RoleService class overview.

// This function gets the role service timeout.
function GetRoleServiceTimeout()
{
    // Get the role service path.
    var roleServiceTimeout = 
        Sys.Services.RoleService.get_timeout();

    DisplayInformation(
            "Role service timeout: " + roleServiceTimeout);

}

See Also

Concepts

Sys.Services.AuthenticationService Class

Sys.Services.ProfileService Class