Compartilhar via


Sys.Services RoleService defaultLoadCompletedCallback Property

Gets or sets the name of the default load-completed callback function.

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 defaultLoadCompletedCallback =
    Sys.Services.RoleService.get_defaultLoadCompletedCallback();
Sys.Services.RoleService.set_defaultLoadCompletedCallback(value); 

Parameters

Parameter

Description

Value

The name of the default load-completed callback function.

Remarks

The function specified in this property is used as the default callback function when the roles have been loaded successfully. You can override this default callback function by passing the name of a different function to the Sys.Services RoleService.load method.

When implementing this callback function, you must use the following signature:

function functionName(result, userContext, methodName)

The parameters passed to the callback function have the following meaning:

  • result. The currently authenticated user's roles.

  • userContext. User context information you passed to the load method.

  • methodName. The calling method. This is always set to load.

The callback function is called asynchronously if the role service completes successfully.

Example

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

// This function checks if the currently
// authenticated user belongs to the
// passed role. 
function UserIsInRole(role) 
{
    DisplayInformation("");
    var isUserInRole = roleProxy.isUserInRole(role);
    DisplayInformation("The user is in the " + role + 
        " role: " + isUserInRole);   
}

See Also

Concepts

Sys.Services.AuthenticationService Class

Sys.Services.ProfileService Class