CRM-12209 Use of aclGroup hook causes permissioned groups not to show

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.3.0
    • Fix Version/s: 4.3.0
    • Component/s: None
    • Labels:
      None

      Description

      ACL hook causes manage group to display incorrect list of groups for users who have groups edited by the ACL hook.

      This isn't a regression bug but I have now debugged why & where it is happening.

      CRM_Contact_BAO::getGroupList

      &&

      CRM_Contact_BAO::getGroupCount

      both call

      CRM_ContactBAO::whereClause

      to generate their where clause. This function does not call the aclGroup hook and includes all groups otherwise possible. After that getGroupList (but not getGroupCount) filters the list down via the aclGroup function.

      As getGroupList applies a limit of 25 it only retrieves 25 results & the removes the ones that are not permitted. In an extreme example which I have on client site none of the first 25 are viewable by the person and hence no groups at all are presented to them.

      More commonly it shows less than the 25 on the first page and they can scroll to the next page for more. The number of groups is always wrong.

      At this stage I think the safest / easiest option is to add a second hook

      aclGroupWhere which allows the function to modify the query @ the where clause - obvious module writers would need to implement this before it would work...

        Attachments

          Activity

          [CRM-12209] Use of aclGroup hook causes permissioned groups not to show
          Eileen McNaughton added a comment -

          NB - it might be that the aclWhereClause hook should be called here? rather than a new one?

          Donald A. Lobo added a comment -

          this issue (and patch?) are related

          http://issues.civicrm.org/jira/browse/CRM-6341

          Eileen McNaughton added a comment -

          I've hit a related issue

          CRM_Contact_BAO_GroupContact::getContactGroup (from the group tab on the summary screen) draws on the ACLWhere clause unlike CRM_Contact_BAO_Group::getContactList

          The shortcoming here is that where returning a clause to filter the list in question knowing the status being requested is important. When checking whether a contact is viewable it's desirable to check if they have been added to whatever groups the hook is interested in.

          However, when the question is 'what groups has the contact been removed from' then the query to be derived in the hook changes somewhat as they should show the group is the contact is viewable and the group is viewable.

          I'm not sure the right hook is actually being called in this case - the contact summary group tab should probably be calling (via whatever method) the aclGroup hook

          Eileen McNaughton added a comment -

          Yeah - I think this is CRM-6341 recurring - & that was kind of my first thought about a fix approach. I can update that for 4.3 & do a PR

          Donald A. Lobo added a comment -


          cool, that would be great

          Eileen McNaughton added a comment -

          looks like this has already been merged in

            People

            • Assignee:
              Eileen McNaughton
              Reporter:
              Eileen McNaughton

              Dates

              • Created:
                Updated:
                Resolved: