Search code examples
drupal-7

How to use drush to give permissions to user


Is there is any Drush Command for Drupal 7 to give all permissions to a newly created role?


Solution

  • Ok, if you don't have an admin role, then you can do this: create a role with drush:

     drush role-create 'my role'    

    Then, you can add all permissions to the created rol:

    drush eval "user_role_grant_permissions(user_role_load_by_name('my role')->rid, array_keys(user_permission_get_modules()));"