You are here

function account_sync_allowed_roles in Account Sync 6

Same name and namespace in other branches
  1. 7.2 account_sync.module \account_sync_allowed_roles()

Figure out which roles have the account sync permissions.

Return all roles that have the 'sync account' permission. If no roles have the sync account permission then returns FALSE.

3 calls to account_sync_allowed_roles()
account_sync_settings in ./account_sync.admin.inc
FAPI callback for the admin settings form.
account_sync_sync_all in ./account_sync.admin.inc
_account_sync_sync_in_deny in ./account_sync.receiver.inc

File

./account_sync.module, line 108

Code

function account_sync_allowed_roles() {
  $result = db_query("SELECT r.name, p.perm FROM {permission} p LEFT JOIN {role} r ON r.rid = p.rid AND r.rid <> %d", DRUPAL_ANONYMOUS_RID);
  $roles = array();
  while ($row = db_fetch_object($result)) {
    $perms = explode(', ', $row->perm);
    if (in_array('sync account', $perms)) {
      $roles[$row->rid] = $row->name;
    }
  }
  return empty($roles) ? FALSE : $roles;
}