Share via


Sys.Services RoleService load Method

Loads the roles for the currently authenticated user into local client memory.

Sys.Services.RoleService.load(loadCompletedCallback, failedCallback, userContext);

Parameters

Parameter

Description

loadCompletedCallback

The function that is called when the load operation has completed. The default is null.

failedCallback

The function that is called if loading has failed. The default is null.

userContext

User context information that is passed to the callback functions.

Remarks

Roles are stored in client memory by the RoleService proxy class and can be accessed by using the roles property. If the call succeeds, the function specified in the [P:J#Sys.Services.RoleService.defaultLoadCompletedCallback] property is called and the list of roles is returned. If the call succeeds and the defaultLoadCompletedCallback property is null, the default SucceededCallback function is called.

If the call to the role service fails, the function specified in the defaultFailedCallback property is called.

Example

The following example shows how to load the roles for the currently authenticated user. This code is part of a complete example found in the RoleService class overview.

// This function sets and gets the role service
// default failed callback function.
function DefaultFailedCallBack()
{
     // Set default failed callback function.
    roleProxy.set_defaultFailedCallback(FailedCallback);

    // Get the default callback function. 
    var failedCallBack =     
        roleProxy.get_defaultFailedCallback();

    alert(failedCallBack); 
}

See Also

Concepts

Sys.Services.AuthenticationService Class

Sys.Services.ProfileService Class