Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
axel committed Dec 23, 2020
1 parent c24ba61 commit b7485ec
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 21 deletions.
1 change: 0 additions & 1 deletion Lib/GrouperApiAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ public function getGroupAttributes($queryData) {
"wsOwnerGroupLookups" => array(
array(
"groupName" => $groupName,

)
)
)
Expand Down
55 changes: 37 additions & 18 deletions Model/GrouperGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,24 @@ public function ownerGroups($userId)
$args['conditions']['groupType'] = 'Owner';
$args['conditions']['userId'] = $userId;

return $this->grouperAPI->getGrouperGroups($args);
$ownGroups = $this->grouperAPI->getGrouperGroups($args);

//Now for each group need to pull in friendly name attribute.
foreach ($ownGroups as &$ownGroup) {
$ownGroup['friendlyName'] = $ownGroup['displayName'];
$attributes = $this->grouperAPI->getGroupAttributes(array('conditions' => array('groupName' => $ownGroup['displayName'])));
foreach ($attributes as $attribute) {
if ($attribute['attributeDefNameName'] == $this->friendly) {
if (isset($attribute['wsAttributeAssignValues'][0]['valueSystem'])) {
$ownGroup['friendlyName'] = $attribute['wsAttributeAssignValues'][0]['valueSystem'];
}
break;
}
}
}

return $ownGroups;

}

public function optinGroups($userId)
Expand All @@ -105,10 +122,11 @@ public function optinGroups($userId)
$args['conditions']['groupType'] = 'Optins';
$args['conditions']['userId'] = $userId;

$returnsToJoinOrLeave = $this->grouperAPI->getGrouperGroups($args);
$joinOrLeave = $this->grouperAPI->getGrouperGroups($args);
$userGroups = $this->userGroups($userId);

foreach ($returnsToJoinOrLeave as &$groupsJoL) {
//See if Optin group match any of the groups belong to already.
foreach ($joinOrLeave as &$groupsJoL) {
foreach ($userGroups as $userGroup) {
$groupsJoL['member'] = false;
if ($groupsJoL['name'] == $userGroup['name']) {
Expand All @@ -119,7 +137,21 @@ public function optinGroups($userId)
}
}

return $returnsToJoinOrLeave;
//Now for each group need to pull in friendly name attribute.
foreach ($joinOrLeave as &$jol) {
$jol['friendlyName'] = $jol['displayName'];
$attributes = $this->grouperAPI->getGroupAttributes(array('conditions' => array('groupName' => $jol['displayName'])));
foreach ($attributes as $attribute) {
if ($attribute['attributeDefNameName'] == $this->friendly) {
if (isset($attribute['wsAttributeAssignValues']['valueSystem'])) {
$jol['friendlyName'] = $attribute['wsAttributeAssignValues']['valueSystem'];
}
break;
}
}
}

return $joinOrLeave;
}

public function createGroup($userId, $groupName, $stemName, $groupDesc)
Expand Down Expand Up @@ -167,21 +199,8 @@ public function getSearchedGroups($userId, $searchCriteria, $page) {

$returnResults = array();

//Will need to get attributes for each group

foreach ($pageResults as &$pageGroup) {
$pageGroup['friendlyName'] = 'unkown';
$groupResults = $this->grouperAPI->getGroupAttributes(array('conditions' => array('groupName' => $pageGroup['groupName'])));
//TODO This will need to be moved into the optinGroups and ownerGroups methods once attribute name decided on.
foreach ($groupResults as $groupResult) {
if ($groupResult['attributeDefNameName'] == $this->friendly) {
$pageGroup['friendlyName'] = $groupResults['wsAttributeAssignValues']['valueSystem'];
break;
}
}
}

//Now we can do a search on all the fields
//Now we can do a search on the fields
//will search on friendly name, group, stem,


Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/groupoptin.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<?php foreach ($groupergroupoptin as $group): ?>
<tr>
<td><?php echo $this->Html->link(
isset($group['name']) ? $group['name'] : "No Name",
isset($group['friendlyName']) ? $group['friendlyName'] : "No Name",
array(
'controller' => 'groupergroups',
'action' => 'groupinfo',
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/groupowner.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<?php foreach ($groupergroupsowner as $group): ?>
<tr>
<td><?php echo $this->Html->link(
isset($group['name']) ? $group['name'] : "No Name",
isset($group['friendlyName']) ? $group['friendlyName'] : "No Name",
array(
'controller' => 'groupergroups',
'action' => 'groupinfo',
Expand Down

0 comments on commit b7485ec

Please sign in to comment.