Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 2.2.7
-
Fix Version/s: 2.2.8
-
Component/s: Drupal Integration Modules
-
Labels:None
Description
CiviCRM_Group_Roles is intended to sync both ways (from Drupal roles to CiviCRM groups and the reverse). The code that modifies Drupal roles based on changes to CiviCRM groups sometimes incorrectly removes a user from a role. It should NOT remove a user from a role if the corresponding contact belongs to any other group which grants that role. This is noted in the code which is commented as "//TO DO: We should really only remove from a role when contact is removed from ALL groups which grant the role."
For example, suppose there is a group "president" associated with the role "officer" and also a group "secretary" associated with the role "officer".
If a contact is a member of both "president" and "secretary" groups, the related Drupal will be in the role "officer".
If the contact is then removed from the group "president" the user should stay in the role "officer" (since their membership in the group "secretary" still entitles them to this role).
The code currently removes the user from the "officer" role in this case. The patch corrects this by determining if the CiviCRM contact belongs to any groups which grant the role. Only if the contact belongs to no groups associated with this role is the role removed from the Drupal user.
This is the first time I've submitted a patch, so feedback is most welcome. I asked about this in the forums http://forum.civicrm.org/index.php/topic,8976.0.html