function _entity_translation_grant_permission in Entity Translation 7
Grant the given permission to all roles which already have any of the permissions specified in the $permissions_filter parameter.
Parameters
$permission: The new permission which to grant.
$permissions_filter: List of permissions used for loading roles.
Return value
A message describing permission changes.
1 call to _entity_translation_grant_permission()
- _entity_translation_grant_edit_permissions in ./
entity_translation.install - Grant 'edit $type original values' permission to existing roles.
File
- ./
entity_translation.install, line 238 - Installation functions for Entity Translation module.
Code
function _entity_translation_grant_permission($permission, $permissions_filter = NULL) {
$roles = user_roles(FALSE, $permissions_filter);
foreach ($roles as $rid => $role) {
user_role_grant_permissions($rid, array(
$permission,
));
}
$t = get_t();
return $t('%permission was assigned to %roles', array(
'%permission' => $permission,
'%roles' => implode(', ', $roles),
));
}