Reputation: 3485
How to list all permissions enabled by given module(s)?
Upvotes: 3
Views: 1402
Reputation: 171
I might be over simplifying the solution but to retrieve the permissions of a module you only need to execute the modules hook_permissions. e.g. call views_permission()
If your looking for all the permissions in the system then you can try calling user_permission_get_modules() which is part of the user module in core.
/**
* Determine the modules that permissions belong to.
*
* @return
* An associative array in the format $permission => $module.
*/
function user_permission_get_modules() {
$permissions = array();
foreach (module_implements('permission') as $module) {
$perms = module_invoke($module, 'permission');
foreach ($perms as $key => $value) {
$permissions[$key] = $module;
}
}
return $permissions;
}
Upvotes: 3