Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I can do loads of user-related stuff with Drush, but I can't see how to create new user roles. Is it possible to do this with Drush?

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

This functionality is available in Drush 8.x-6.x:

 role-add-perm (rap)   Grant a specified permission to a role.                  
 role-create (rcrt)    Create a new role.                                       
 role-delete (rdel)    Delete a role.                                           
 role-list (rls)       Display a list of all roles defined on the system.  If a 
                       role name is provided as an argument, then all of the    
                       permissions of that role will be listed.  If a           
                       permission name is provided as an option, then all of    
                       the roles that have been granted that permission will be 
                       listed.                                                  
 role-remove-perm      Remove a specified permission from a role.               
 (rmp)                                                                          

Unfortunately, this has not been backported to the 7.x-5.x branch, so it probably won't be in the soon-to-be-released Drush-5.9, and isn't in Drush-5.8. For now, you'll have to use the dev branch to get it.

share|improve this answer
add comment

To get a list of all drush based commands just type drush at the command prompt and it will list all the set of commands available.

drush help [command] to view command-specific help.

Run drush topic to read even more documentation.

Drush user specific commands

User commands: (user)

user-add-role (urol) Add a role to the specified user accounts.

user-block (ublk) Block the specified user(s).

user-cancel (ucan) Cancel a user account with the specified name.

user-create (ucrt) Create a user account with the specified name.

user-information Print information about the specified user(s). (uinf)

user-login (uli) Display a one time login link for the given user account (defaults to uid 1).

user-password (upwd) (Re)Set the password for the user account with the specified name.

user-remove-role Remove a role from the specified user accounts. (urrol)

user-unblock (uublk) Unblock the specified user(s).

share|improve this answer
    
Can you add in the syntax that generate this? –  MPD Jan 10 '13 at 19:07
    
drush help --filter=user –  greg_1_anderson Jan 11 '13 at 20:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.