Skip to content

Commit

Permalink
Merge pull request #6778 from eileenmcnaughton/CRM-17255
Browse files Browse the repository at this point in the history
CRM-17255 group.api ACLS : do not exclude hidden groups for ACL users
  • Loading branch information
davecivicrm committed Sep 22, 2015
2 parents 43ee735 + addbec4 commit 4e476ed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions CRM/Contact/BAO/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,17 @@ public static function getGroups(
*
* @param int $id
* The id of the object.
* @param bool $excludeHidden
* Should hidden groups be excluded.
* Logically this is the wrong place to filter hidden groups out as that is
* not a permission issue. However, as other functions may rely on that defaulting to
* FALSE for now & only the api call is calling with true.
*
* @return string
* the permission that the user has (or NULL)
* @return array
* The permission that the user has (or NULL)
*/
public static function checkPermission($id) {
$allGroups = CRM_Core_PseudoConstant::allGroup();
public static function checkPermission($id, $excludeHidden = FALSE) {
$allGroups = CRM_Core_PseudoConstant::allGroup(NULL, $excludeHidden);

$permissions = NULL;
if (CRM_Core_Permission::check('edit all contacts') ||
Expand Down
4 changes: 2 additions & 2 deletions CRM/Core/PseudoConstant.php
Original file line number Diff line number Diff line change
Expand Up @@ -933,14 +933,14 @@ public static function &countryIsoCode($id = FALSE) {
* @return array
* array reference of all groups.
*/
public static function &allGroup($groupType = NULL, $excludeHidden = TRUE) {
public static function allGroup($groupType = NULL, $excludeHidden = TRUE) {
$condition = CRM_Contact_BAO_Group::groupTypeCondition($groupType, $excludeHidden);

if (!self::$group) {
self::$group = array();
}

$groupKey = $groupType ? $groupType : 'null';
$groupKey = ($groupType ? $groupType : 'null') . !empty($excludeHidden);

if (!isset(self::$group[$groupKey])) {
self::$group[$groupKey] = NULL;
Expand Down

0 comments on commit 4e476ed

Please sign in to comment.