function nodeaccess_get_role_aliases in Nodeaccess 7
Same name and namespace in other branches
- 5 nodeaccess.module \nodeaccess_get_role_aliases()
- 6.2 nodeaccess.module \nodeaccess_get_role_aliases()
- 6 nodeaccess.module \nodeaccess_get_role_aliases()
Retrieve role aliases.
Return value
array Role aliases indexed by rid.
2 calls to nodeaccess_get_role_aliases()
- nodeaccess_admin_form in ./
nodeaccess.admin.inc - Menu callback. Draws the admin page.
- theme_nodeaccess_grants_form in ./
nodeaccess.module - Theme function for nodeaccess_grants_form.
File
- ./
nodeaccess.module, line 837 - Provide per node access control
Code
function nodeaccess_get_role_aliases() {
$aliases = array();
$query = db_select('role', 'r');
$query
->leftJoin('nodeaccess_role_alias', 'a', 'r.rid = a.rid');
$query
->fields('r', array(
'rid',
'name',
));
$query
->addField('a', 'name', 'alias');
$query
->addField('a', 'weight');
$query
->orderBy('a.weight');
$query
->orderBy('r.weight');
$query
->orderBy('a.name');
$query
->orderBy('r.name');
$result = $query
->execute();
while ($a = $result
->fetch()) {
$aliases[$a->rid]['name'] = $a->name;
$aliases[$a->rid]['alias'] = $a->alias;
$aliases[$a->rid]['weight'] = $a->weight;
}
return $aliases;
}