How can I give a user a specific role upon login

Category: 

  • Question

When logging in via touchstone, all users seem to get the same role: “Authenticated User”. I’ve created a site-specific role with limited permissions and I want to give it to users who can log in. I’ve setup a Shibboleth whitelist and put a kerb name on it. When this user logs in, I want to give them my newly created role. How do I accomplish this.

-- Rich

4/21/16

I'm fairly sure this is a use case for the rules module, however I can't find a way to get the username for comparison. I was able, with some effort, to add a rule and an action, but the condition is the problem. It seems to want to compare user id (numeric) which seems to suggest that the only users rules knows about are the drupal users created by drupal; it doesn't seem to know about Shibboleth users.

THis seems like a common use case. What am I missing?

-- Rich

4/21/16

I'm not an expert on Rules, but it should work for your use-case. I may be running into a similar glitch, however. I'm using "After saving a new user account" for my Event. I then selected "data comparison" for my Condition. Usually at this step you can expand the "data selectors" fieldset, but mine is not working. It does work for a non-Drupal Cloud site, and offers options like account:name and account:mail. Possibly a bug.

4/26/16