drupal 7 grant all permissions to role
In Drupal 7, some times you need to add every possible permission to a particular user. In my case, I had a site where the administrator role was not receiving all of the new permissions implemented throughout the development workflow. This code quickly let me grant the administrator role all permissions however.
// Get the Role ID we want to add all permissions to. $rid = user_role_load_by_name('administrator')->rid; // Get a listing of all of the permissions $perms = array_keys(user_permission_get_modules()); // Grant permissions for the role user_role_grant_permissions($rid, $perms);