Merge pull request #6468 from eileenmcnaughton/CRM-17010
[civicrm-core.git] / CRM / Contact / BAO / GroupContact.php
index db4baa51662dfb612a9af3fe6549220f799d45cb..8a4bb40b9e98b669c862d26caa0e2ea13fc9b118 100644 (file)
@@ -803,15 +803,10 @@ AND    contact_id IN ( $contactStr )
 
     $options = CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
 
-    if (($fieldName == 'group' || $fieldName == 'group_id')) {
-      // Enforce group visibility permissions
-      if (!empty($props['check_permissions'])) {
-        $options = CRM_Core_PseudoConstant::group();
-      }
-      if ($context == 'search' || $context == 'create') {
-        // Sort group list by hierarchy
-        $options = CRM_Contact_BAO_Group::getGroupsHierarchy($options, NULL, '- ', TRUE);
-      }
+    // Sort group list by hierarchy
+    // TODO: This will only work when api.entity is "group_contact". What about others?
+    if (($fieldName == 'group' || $fieldName == 'group_id') && ($context == 'search' || $context == 'create')) {
+      $options = CRM_Contact_BAO_Group::getGroupsHierarchy($options, NULL, '- ', TRUE);
     }
 
     return $options;