Affects Version/s: 2.0
Fix Version/s: 2.1
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',
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?