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

og_sync using same acl_role_id in civicrm_entity_acl_role

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Critical
    • Resolution: Fixed/Completed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Component/s: None
    • Labels:
      None

      Description

      CiviCRM 2.0.2 with og_sync

      Once 9 Organic Groups have been added, all subsequent CiviCRM ACL Roles created by og_sync have a value of 10.

      This is because in line 127 of CRM/Bridge/OG/Drupal.php the following code get the wrong value

      $dao->value = CRM_Utils_Weight::getDefaultWeight( 'CRM_Core_DAO_OptionValue',
      $weightParams,
      'value' );

      The value is incorrect because the VALUE column of civicrm_option_value is of VARCHAR type, so '9' is greater than '10' in string terms.

      However the logic for adding ACL Roles from the CiviCRM UI works as expected.

      Sort term workaround - in CRM/Bridge/OG/Drupal.php, also put the newly computed Weight into the VALUE column. These are reasonably unique.

      A possible "fix" to the code would be to copy the logic used by the CiviCRM UI in handling creation of new ACL Roles (would submit a patch but I haven't found the right code yet).

      This use of the VALUE in civicrm_option_value seems to be a bad idea in the long term - would it be possible to use the ID instead, as this is guaranteed to be unique?

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              mhonman Mark Honman
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: