When I use the CAS module (http://drupal.org/project/cas) for authentication, Reg path will not assign a role on top of the whatever roles I set using the CAS module's (version 7.x-1.1) User Account settings upon login.

Comments

grasmash’s picture

I'll have to look into how the CAS module actually sets roles. I recently change P2RP so that it simply sets default roles in the $form object. However, this can also be set using hook_user_presave(), which was my previous (more lengthy) approach.

grasmash’s picture

Title: Does not assign role when used with the CAS module » Profile2 Registration Path does not assign role when used with the CAS module
Project: Profile2 Registration Path » CAS
Version: 7.x-1.5 » 7.x-1.1
Component: Code » CAS

*MOVING TO CAS QUEUE*

This actually seems to be an issue with the CAS module.

cas_user_register() sets the $edit['roles'] array to be empty, and then goes on to populate it. This erases the roles that profile2_regpath adds.

You might be able to get around this by changing the module weights in the {system} table such that the CAS module runs before profile2_regpath.

Otherwise, I'd suggest modifying cas_user_register() and submitted a patch to that issue queue.

bfroehle’s picture

Project: CAS » Profile2 Registration Path
Version: 7.x-1.1 » 7.x-1.x-dev
Component: CAS » Code

Bouncing this one back to you for clarification. How can this be the fault of cas_user_register? When that function is called the user doesn't exist yet, nor is there an $edit or similar.

The call chain, as far as I can tell, would be

cas_user_register()
->user_save()
->profile2_regpath_user_presave()

Now somewhat confusingly cas_user_register() sometimes calls user_save() twice. Maybe thats what is causing the interference?

grasmash’s picture

Category: bug » feature

Switching this to a feature request.

grasmash’s picture

Status: Active » Closed (won't fix)

I'm not personally going to implement integration with the CAS module. Please re-open if you'd like to contribute a patch.

bfroehle’s picture

Hi Matt. A CAS developer here...

Thanks for the clarification. I originally missed the note in your first post:

I'll have to look into how the CAS module actually sets roles. I recently change P2RP so that it simply sets default roles in the $form object. However, this can also be set using hook_user_presave(), which was my previous (more lengthy) approach.

Setting the roles as the default in $form isn't compatible with the CAS module (since such a form never exists during our login process).

Since the original person who requested this hasn't chimed in again, let's just keep this issue closed.
Thanks!

grasmash’s picture

Ah, that makes sense. I agree with your conclusion-- let's put this on hold unless it is requested again.

aanjaneyam’s picture

Status: Closed (won't fix) » Active

Hi I am implementing a cas sso on my websites which includes main website with general information, a shop /store related to our services described on main site using drupal commerce and a project management site using open atrium. The three sites will have different roles managed from cas server and then mapped to respective sites. For this I intend to use Profile2 and Profile 2 registration path to implement user registration for different role types and automatic role assignment when user registers as a role type. Each role will have different profile2 registration form suitable for that role and upon regisitering will be automatically assigned the role related to that profile registration form at its unique path. For example there will be a role customer on main site and shop with different permissions on each site. When a potential customers visits our main or shop sites and needs to register he would click on customer registration button which will redirect him to the cas server at unique customer profile form at /user/register/customer. Upon registering he would automatically be assigned the role customer using profile2 regpath which in turn would be mapped from cas server to main and store sites (deriving different permissions from each site). I also intend to map customer profile2 text fields from cas server to respective profile2 text fileds in man and store sites.

I was wondering if this issue would prevent me from doing the above described. The above plan would not work if P2rp doesn't automatically assigns role over and above the authenticated user role assigned by default by CAS module. If this is the case I would also support the feature requested in this issue. OR is my plan above is not workable with the current state of profile2, P2rp and CAS modules.. OR I am wrongly understanding the working of CAS and profile modules.

aanjaneyam’s picture

Issue summary: View changes

added version of CAS module I'm using.