function farm_access_available_perms in farmOS 7
Gets a list of all available farm permissions.
Parameters
string $role: A farm role machine name to get current permissions for.
Return value
array Returns an array of permission strings.
1 call to farm_access_available_perms()
- farm_access_compare_perms in modules/
farm/ farm_access/ farm_access.module - Compares available permissions to actual permissions.
File
- modules/
farm/ farm_access/ farm_access.module, line 310 - Farm Access module.
Code
function farm_access_available_perms($role) {
// Load the permissions provided by this module on behalf of others.
module_load_include('inc', 'farm_access', 'farm_access.modules');
// Invoke hook_farm_access_perms() to allow modules to provide permissions.
$perms = module_invoke_all('farm_access_perms', $role);
// Unset any that don't exist.
// This can be an issue with Taxonomies provided by Features.
$permissions_modules = user_permission_get_modules();
foreach ($perms as $key => $perm) {
if (empty($permissions_modules[$perm])) {
unset($perms[$key]);
}
}
// Allow other modules to alter the permissions for this role.
drupal_alter('farm_access_perms', $role, $perms);
// Return them.
return $perms;
}