diff --git a/Model/GrouperGroup.php b/Model/GrouperGroup.php index 7221912..829e8bf 100644 --- a/Model/GrouperGroup.php +++ b/Model/GrouperGroup.php @@ -115,7 +115,6 @@ public function groupDescriptions($groupName) { $args = array(); $args['conditions']['groupName'] = $groupName; - $groupDescription = $this->grouperAPI->getGrouperGroupDescription($args); //make call to get attributes for group $grouperAtt = new GrouperAttribute(); @@ -276,11 +275,30 @@ public function getSearchedGroups($userId, $searchCriteria, $page) { * * @param array $groups Current result set of Groups * @return array Same result set with added param for friendly name - * @throws GrouperLiteException * */ private function getFriendlyName(array $groups) { + //NOT fetching attributes now, just using name display name as friendly name, if different from name field + foreach ($groups as &$group) { + //$group['friendlyName'] = $group['displayName']; + $nameSections = explode(':', $group['name']); + $friendlySections = explode(':', $group['displayName']); + $numberNameSections = count($nameSections); + for($x = 0; $x < $numberNameSections; $x++){ + if ($nameSections[$x] == $friendlySections[$x]) { + unset($friendlySections[$x]); + } + } + $group['friendlyName'] = implode(':', $friendlySections); + if(strlen($group['friendlyName']) == 0 ){ + $group['friendlyName'] = $group['name']; + } + } + + return $groups; + + /* Old Process, keeping in case changes back! foreach ($groups as &$group) { $group['friendlyName'] = $group['displayName']; $attributes = $this->grouperAPI->getGroupAttributes(array('conditions' => array('groupName' => $group['displayName']))); @@ -292,8 +310,7 @@ private function getFriendlyName(array $groups) { break; } } - } - return $groups; + }*/ } }