Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-19494

Refactoring of permission code

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.12
    • Fix Version/s: 4.7.14
    • Component/s: Core CiviCRM
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      If you look at the CRM_Contact_BAO_Contact_Permission you'll see that if we want to check individual permissions we only have the ::allow() method which we would have to call for each contact individually - and this call is actually quite expensive.

      In a context like PR-9193 this would mean 50+ calls and a serious performance problem.

      Therefore I did the following (after talking to Eileen McNaughton in the Edale sprint):

      1. I created a method ::allowList() that can batch process contact_ids for permissions
      2. I added the respective unit tests
      3. By doing that I found and fixed two bugs in the original code

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              b.systopia Björn Endres
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: