You are here

function services_client_get_remote_roles in Services Client 7

Retrieve roles from remote site

Parameters

$conn: Connection definition

$client: Client

1 call to services_client_get_remote_roles()
services_client_process_roles_mapping in ./services_client.module
Create mapping of roles from remote site

File

./services_client.module, line 1159
Services client module allows to push different types of objects on different types of events such as node_save, user_save to remote masters.

Code

function services_client_get_remote_roles($conn, $client) {
  $cid = 'services_client:remote_roles:' . $conn;
  $roles = array();
  if ($cache = cache_get($cid)) {
    $roles = $cache->data;
  }
  else {
    $roles = $client
      ->action('user', 'list_roles');

    // Cache data for 1 hour
    cache_set($cid, $roles, 'cache', time() + 60 * 60);
  }
  return $roles;
}