function _update_7000_user_role_grant_permissions
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
5 calls to _update_7000_user_role_grant_permissions()
- field_update_7004 in modules/
field/ field.install - Grant the new "administer fields" permission to trusted users.
- filter_update_7005 in modules/
filter/ filter.install - Integrate text formats with the user permissions system.
- filter_update_7008 in modules/
filter/ filter.install - Grant usage of all text formats to user roles having the 'administer filters' permission.
- node_update_7008 in modules/
node/ node.install - Split the 'administer nodes' permission from 'access content overview'.
- system_update_7067 in modules/
system/ system.install - Grant administrators permission to view the administration theme.
File
-
modules/
user/ user.install, line 402
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();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.