function account_sync_allowed_roles in Account Sync 7.2
Same name and namespace in other branches
- 6 account_sync.module \account_sync_allowed_roles()
Find all roles that have the account sync permission.
Return value
Array an array of all roles that have the 'sync account' permission of the form array($rid => $name, ...). If no roles have the sync account permission then return 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 - Sync all accounts from this site to a 3rd party drupal site.
- _account_sync_sync_in_deny in ./
account_sync.receiver.inc - Check a any cases that should trigger us to deny the sync.
File
- ./
account_sync.module, line 135 - Contains the base module code and hooks for the account sync module.
Code
function account_sync_allowed_roles() {
$roles = db_query("SELECT r.rid, r.name FROM {role_permission} p LEFT JOIN {role} r ON r.rid = p.rid WHERE p.permission = 'sync account' AND r.rid <> :anonymous", array(
':anonymous' => DRUPAL_ANONYMOUS_RID,
))
->fetchAllAssoc('rid');
$roles = array_map(function ($a) {
return $a->name;
}, $roles);
return empty($roles) ? FALSE : $roles;
}