You are here

protected function UserSaveHandler::getRemoteRoles in Services Client 7.2

Get list of remote roles.

Return value

array Remote connection roles.

3 calls to UserSaveHandler::getRemoteRoles()
UserSaveHandler::beforeSync in include/event.inc
Add role mapping.
UserSaveHandler::configForm in include/event.inc
Config form.
UserSaveHandler::refreshRemoteRoles in include/event.inc
Force refreshing list of remote roles.

File

include/event.inc, line 1451

Class

UserSaveHandler

Code

protected function getRemoteRoles() {
  $cid = 'services_client:remote_roles:' . $this->event->connection;
  $roles = array();
  if ($cache = cache_get($cid)) {
    $roles = $cache->data;
  }
  else {
    try {
      $roles = $this
        ->getConnection()
        ->action('user', 'list_roles');
      cache_set($cid, $roles, 'cache', time() + 60 * 60);
    } catch (ServicesClientConnectionResponseException $e) {
      $e
        ->log();
      $roles = array();
    }
  }
  return $roles;
}