| 7 user.install | _update_7000_user_role_grant_permissions($rid, array $permissions, $module) |
Utility function: grant a set of permissions to a role during update.
This function is valid for a database schema version 7000.
Parameters
$rid: The role ID.
$permissions: An array of permissions names.
$module: The name of the module defining the permissions.
Related topics
4 calls to _update_7000_user_role_grant_permissions()
File
- modules/
user/ user.install, line 389 - Install, update and uninstall functions for the user module.
Code
function _update_7000_user_role_grant_permissions($rid, array $permissions, $module) {
// Grant new permissions for the role.
foreach ($permissions as $name) {
db_merge('role_permission')
->key(array(
'rid' => $rid,
'permission' => $name,
))
->fields(array(
'module' => $module,
))
->execute();
}
}
Login or register to post comments