Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dasginganinja/ed1acf67d0c4dd0226d9 to your computer and use it in GitHub Desktop.
Save dasginganinja/ed1acf67d0c4dd0226d9 to your computer and use it in GitHub Desktop.
Drupal 7 Drush Command to Grant All Permission to A Role
<?php
// Get the Role ID we want to add all permissions to
$rid = user_role_load_by_name('Super 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);
drush eval "user_role_grant_permissions(user_role_load_by_name('Super Administrator')->rid, array_keys(user_permission_get_modules()));"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment