For now if you want to add user-selectable roles the only way to do it is to go to admin/config/people/autoassignrole/user in the GUI, check the roles you want, and click save.

My deployment method needs to deploy these roles to environments in code (specifically, in hook_update_n() in my site deployment module.

Because roles exported with features have different IDs on different environments, setting this programmatically is currently unwieldy.

It would be nice to have an API function which allows one to bypass the GUI altogether.

Comments

alberto56’s picture

Status: Active » Needs review
StatusFileSize
new1.37 KB

Here is a patch which adds the following function

autoassignrole_set_user_selectable_roles()

Usage (example)

autoassignrole_set_user_selectable_roles(array('myrole1', 'myrole2'));

Cheers,

Albert

mike.davis’s picture

Hi Albert,

Thanks for this - this does look like a good solution to being able to 'feature' this setting into code for deployment.

Thanks
Mike

mike.davis’s picture

mike.davis’s picture

Status: Needs review » Fixed

This has been committed now, thanks.

As 7.x-2.x will include feature support there is no need for this to be ported to 7.x-2.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.