Skip to content

Commit

Permalink
Fixed merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Oct 13, 2022
2 parents da1d7fd + 246c6d4 commit 95145f3
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 199 deletions.
52 changes: 5 additions & 47 deletions Controller/GrouperGroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,7 @@ public function groupOwner()

$data = $this->Paginator->paginate('GrouperGroup', $scope);

$finalData = $this->breakoutGroups($data, 'admin');

$this->set('groupsowners', $finalData['adHocGroups']);
$this->set('wgowners', $finalData['workingGroups']);
$this->set('groupsowners', $data);

} catch (Exception $e) {
CakeLog::write('error', __METHOD__ . ' Search: ' . var_export($e->getMessage(), true));
Expand All @@ -428,10 +425,7 @@ public function groupOwner()

$data = $this->Paginator->paginate('GrouperGroup', $scope);

$finalData = $this->breakoutGroups($data, 'admin');

$this->set('groupsowners', $finalData['adHocGroups']);
$this->set('wgowners', $finalData['workingGroups']);
$this->set('groupsowners', $data);

} catch (Exception $e) {
CakeLog::write('error', __METHOD__ . ': ' . var_export($e->getMessage(), true));
Expand Down Expand Up @@ -483,6 +477,7 @@ public function groupMember()
$scope['method'] = 'getSearchedGroups';
$scope['searchcriteria'] = $searchCriteria;
$scope['searchpage'] = 'filteredMemberOfGroups';
$scope['ContainsWG'] = true;

$data = $this->Paginator->paginate('GrouperGroup', $scope);

Expand Down Expand Up @@ -559,12 +554,8 @@ public function groupOptin()
$scope['searchpage'] = 'optinGroups';

$data = $this->Paginator->paginate('GrouperGroup', $scope);
//$this->set('groupoptin', $data);

$finalData = $this->breakoutGroups($data, 'optin');

$this->set('groupoptins', $finalData['adHocGroups']);
$this->set('wgoptins', $finalData['workingGroups']);
$this->set('groupoptins', $data);

} catch (Exception $e) {
CakeLog::write('error', __METHOD__ . 'Search: ' . var_export($e->getMessage(), true));
Expand All @@ -580,12 +571,8 @@ public function groupOptin()
$scope['method'] = 'optinGroups';

$data = $this->Paginator->paginate('GrouperGroup', $scope);
//$this->set('groupoptin', $data);

$finalData = $this->breakoutGroups($data, 'optin');

$this->set('groupoptins', $finalData['adHocGroups']);
$this->set('wgoptins', $finalData['workingGroups']);
$this->set('groupoptins', $data);

} catch (Exception $e) {
CakeLog::write('error', __METHOD__ . ': ' . var_export($e->getMessage(), true));
Expand Down Expand Up @@ -1011,35 +998,6 @@ private function breakoutGroups(array $recordSet, $type = 'basic')
}
}

if ($type == 'basic' || $type == 'admin') {
//Need to surface Optout flag to top level of a Working Group
foreach ($wgData as &$wgRec) {
$subCount = 0;
foreach ($wgRec['Groups'] as $rec) {
if (isset($rec['optOut'])) {
$wgRec['optOut'] = true;
}
$wgRec['workingGroupId'] = $rec['name'];
$wgRec['workingGroupUUID'] = $rec['uuid'];
$wgRec['workingDesc'] = $this->hackDescription($rec['description']);
//Capturing record for incommon-collab since deleting a few lines below.
if ($rec['WGApp'] == 'incommon-collab') {
unset($wgRec['Groups'][$subCount]);
}
$subCount += 1;
}

}
} elseif ($type == 'optin') {
//Working Groups that will show up on the Optin Page
foreach ($wgData as &$wgRec) {
$wgRec['workingGroupId'] = $wgRec['Groups'][0]['name'];
$wgRec['workingGroupUUID'] = $wgRec['Groups'][0]['uuid'];
$wgRec['workingDesc'] = $this->hackDescription($wgRec['Groups'][0]['description']);
unset($wgRec['Groups']);
}
}

return array(
'adHocGroups' => $notWGData,
'workingGroups' => $wgData
Expand Down
42 changes: 27 additions & 15 deletions Model/GrouperGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,12 @@ public function paginate($conditions)
}

} else {
if ($method == 'getSearchedGroups' || $method == 'filteredMemberOfGroups') {
if (isset($conditions['ContainsWG']) && $method == 'getSearchedGroups') {
$friendlyResults = $this->getFriendlyWorkingGroupName($resultSet, 'member');
} elseif ($method == 'filteredMemberOfGroups') {
$friendlyResults = $this->getFriendlyWorkingGroupName($resultSet, 'member');
} else {
$friendlyResults = $this->getFriendlyWorkingGroupName($resultSet, '');
$friendlyResults = $this->getFriendlyName(array_values($resultSet));
}
}

Expand All @@ -661,7 +663,6 @@ public function paginate($conditions)
*/
private function getFriendlyWorkingGroupName(array $groups, $method)
{

$arrayIndex = 0;
$workingGroups = array();

Expand All @@ -686,6 +687,12 @@ private function getFriendlyWorkingGroupName(array $groups, $method)
$len = strlen($stem);
// if match to name of group within WG mapping then start making a WG group array
if (substr(strtolower($group['name']), 0, $len) === $stem) {
$tempGroup = $group;
if ($stem == 'ref:incommon-collab' || $stem == 'ref:internet2-collab') {
$mainGroup = true;
} else {
$mainGroup = false;
}
$stemSections = explode(':', $group['name']);
$displaySections = explode(':', $group['displayName']);
//Get second to last stem section
Expand All @@ -694,13 +701,13 @@ private function getFriendlyWorkingGroupName(array $groups, $method)
if (in_array($stemSections[$sectionCount], $topLevelWG) === false) {
break;
}
$group['WGName'] = $stemSections[$sectionCount];
$group['WGShowName'] = $displaySections[$sectionCount];
//Get user type, which is after the WG name
$tempGroup['WGName'] = $stemSections[$sectionCount];
$tempGroup['WGShowName'] = $displaySections[$sectionCount];
// Get user type, which is after the WG name
if (isset($stemSections[$sectionCount + 1])) {
$group['WGRole'] = $stemSections[$sectionCount + 1];
$tempGroup['WGRole'] = $stemSections[$sectionCount + 1];
} else {
$group['WGRole'] = '';
$tempGroup['WGRole'] = '';
}
$appCount = 0;
$appName = '';
Expand All @@ -720,21 +727,26 @@ private function getFriendlyWorkingGroupName(array $groups, $method)
//changed the way email list are displayed to actually show lists email address.
if ($appName == 'sympa - internet2' || $appName == 'sympa - incommon') {
if ($appName == 'sympa - internet2') {
$appName = $group['WGName'] . '@lists.' . 'internet2.edu';
$appName = $tempGroup['WGName'] . '@lists.' . 'internet2.edu';
} else {
$appName = $group['WGName'] . '@lists.' . 'incommon.org';
$appName = $tempGroup['WGName'] . '@lists.' . 'incommon.org';
}

}
$group['WGApp'] = $appName;
$tempGroup['WGApp'] = $appName;
if ($method == 'member') {
if ($group['WGRole'] !== 'admins' && $group['WGRole'] !== 'owner') {
$workingGroups[] = $group;
// Screening out groups owned since this page show memberships not ownership!
// if ($tempGroup['WGRole'] !== 'admin' && $tempGroup['WGRole'] !== 'owner' && !$mainGroup ) {
// $workingGroups[] = $tempGroup;
// }
if(!$mainGroup) {
$workingGroups[] = $tempGroup;
unset($groups[$arrayIndex]);
}
} else {
$workingGroups[] = $group;
$workingGroups[] = $tempGroup;
unset($groups[$arrayIndex]);
}
unset($groups[$arrayIndex]);
}
}
$arrayIndex += 1;
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/groupmember.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ $collapsed = $config['defaultCollapse'] === 'collapsed' ? true : false;
<?php if (strpos($group['WGApp'], '@lists') !== false) : ?>
<td><?php echo _txt('pl.grouperlite.value.email'); ?></td>
<?php else : ?>
<td><?php echo _txt('pl.grouperlite.value.' . strtolower($group['WGApp'])) ?? _txt('pl.grouperlite.value.descr.zerostate'); ?></td>
<td><?php echo $group['description'] ?? _txt('pl.grouperlite.value.descr.zerostate'); ?></td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
Expand Down
33 changes: 3 additions & 30 deletions View/GrouperGroups/groupoptin.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $numColumns = count($columns);
$collapsed = $config['defaultCollapse'] === 'collapsed' ? true : false;

?>
<?php if (count($groupoptins) > 0 || count($wgoptins) > 0) : ?>
<?php if (count($groupoptins) > 0) : ?>
<div class="grouper-table">
<?php print $this->element("pagination", array(
'goto' => false,
Expand Down Expand Up @@ -65,34 +65,7 @@ $collapsed = $config['defaultCollapse'] === 'collapsed' ? true : false;
</tr>
<?php endforeach; ?>
</tbody>
<tbody>
<tr class="table-secondary">
<td colspan="<?php echo $numColumns; ?>">
<button type="button" class="btn btn-link btn-text collapse-btn <?php echo $collapsed ? 'collapsed' : ''; ?> fw-bold m-0" data-toggle="collapse" data-target=".collapse-wg-working-group-parent" role="button" aria-expanded="<?php echo $collapsed ? 'false' : 'true'; ?>">
<?php echo $config['wgHeading'] ?? 'Working groups'; ?>
<em class="material-icons mt-0" aria-hidden="true"><?php echo $collapsed ? 'arrow_drop_down' : 'arrow_right' ?></em>
</button>
</td>
</tr>
<?php foreach ($wgoptins as $i => $wgoptin) : ?>
<tr class="<?php echo $collapsed ? 'collapse' : 'show'; ?> collapse-wg-working-group-parent">
<td colspan="<?php echo $numColumns - 2; ?>">
<span class="h6"><?php echo $wgoptin['WGShowName'] ?? "No Name"; ?></span>
</td>
<td>
<?php echo $wgoptin['workingDesc'] ?? " "; ?>
</td>
<td>
<?php echo $this->element('GrouperLite.Components/optAction', array(
'member' => false,
'action' => 'joingroup',
'group' => $wgoptin['workingGroupId'],
'idx' => $key
)); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>

</table>
<?php print $this->element("pagination", array(
'goto' => false,
Expand All @@ -108,7 +81,7 @@ $collapsed = $config['defaultCollapse'] === 'collapsed' ? true : false;
});
</script>
<?php endif; ?>
<?php if (count($groupoptins) < 1 && count($wgoptins) < 1) : ?>
<?php if (count($groupoptins) < 1) : ?>
<div class="alert alert-info">
<p class="lead mb-0 text-center"><?php echo _txt('pl.grouperlite.groups.zero-state'); ?></p>
</div>
Expand Down
108 changes: 2 additions & 106 deletions View/GrouperGroups/groupowner.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $numColumns = count($columns);

$collapsed = $config['defaultCollapse'] === 'collapsed' ? true : false;
?>
<?php if (count($groupsowners) > 0 || count($wgowners) > 0) : ?>
<?php if (count($groupsowners) > 0) : ?>
<div class="grouper-table">
<?php print $this->element("pagination", array(
'goto' => false,
Expand Down Expand Up @@ -95,110 +95,6 @@ $collapsed = $config['defaultCollapse'] === 'collapsed' ? true : false;
</tr>
<?php endforeach; ?>
</tbody>
<tbody>
<tr class="table-secondary">
<td colspan="<?php echo $numColumns; ?>">
<button type="button" class="btn btn-link btn-text collapse-btn fw-bold m-0 work-group-heading-btn <?php echo $collapsed ? 'collapsed' : ''; ?>" data-toggle="collapse" data-target=".collapse-wg-working-group-parent" role="button" aria-expanded="<?php echo $collapsed ? 'false' : 'true'; ?>">
<?php echo $config['wgHeading'] ?? 'Working groups'; ?>
<em class="material-icons mt-0" aria-hidden="true"><?php echo $collapsed ? 'arrow_drop_down' : 'arrow_right' ?></em>
</button>
</td>
</tr>
<?php if (!count($wgowners)) : ?>
<tr class="table-light <?php echo $collapsed ? 'collapse' : 'show'; ?> collapse-wg-working-group-parent">
<td colspan="<?php echo $numColumns; ?>" class="text-center">None</td>
</tr>
<?php endif; ?>
<?php foreach ($wgowners as $wggroup) : ?>
<tr class="table-light <?php echo $collapsed ? 'collapse' : 'show'; ?> collapse-wg-working-group-parent">
<td colspan="<?php echo $numColumns - 3; ?>">
<button type="button" class="btn btn-link btn-text collapse-btn fw-bold m-0 <?php echo $collapsed ? 'collapsed' : ''; ?>" data-toggle="collapse" data-target=".collapse-wg-<?php echo $wggroup['WGName']; ?>" role="button" aria-expanded="<?php echo $collapsed ? 'false' : 'true'; ?>">
<?php echo $wggroup['WGShowName'] ?? "No Name"; ?>
<em class="material-icons mt-0" aria-hidden="true"><?php echo $collapsed ? 'arrow_drop_down' : 'arrow_right' ?></em>
</button>
</td>
<td colspan="2">
<?php echo $wggroup['workingDesc'] ?? " "; ?>
</td>
<td>
<span class="d-flex flex-row justify-content-center align-items-center">
<?php echo $wggroup['optOut'] ? $this->element('GrouperLite.Components/optAction', array(
'member' => $wggroup['optOut'],
'action' => 'leavegroup',
'group' => $wggroup['workingGroupId'],
'idx' => $key
)) : ''; ?>
<button class="btn btn-grouper btn-block btn-primary btn-sm m-1 text-nowrap members-btn" data-id="<?php echo $wggroup['WGName']; ?>" data-name="<?php echo ($wggroup['WGShowName']); ?>">
<?php echo _txt('pl.grouperlite.action.members'); ?> <em class="material-icons mt-0" aria-hidden="true">group</em>
</button>
<?php if ($isuserowner === 'T' && $isGrouperVisible === 'T') : ?>
<?php
$baseUrl = $grouperbaseurl;
$path = '/grouper/grouperUi/app/UiV2Main.index';
$groupOperation = '?operation=UiV2Group.viewGroup&groupId=';
$groupUrlBase = $baseUrl . $path . $groupOperation;
$attrOperation = '?operation=UiV2AttributeDefName.viewAttributeDefName&attributeDefNameId=';
$attrUrlBase = $baseUrl . $path . $attrOperation;
?>
<a href="<?php echo $groupUrlBase . $wggroup['workingGroupUUID']; ?>" class="btn btn-grouper btn-block btn-sm btn-success mt-0 text-nowrap" target="_blank" role="button">
<?php echo _txt('pl.grouperlite.action.grouper'); ?> &nbsp;
<em class="material-icons mt-0" aria-hidden="true">link</em>
</a>
<?php endif ?>
</span>
</td>
</tr>

<?php /*foreach ($wgowner['Groups'] as $key => $group) : ?>
<tr class="<?php echo $collapsed ? 'collapse' : 'show'; ?> collapse-wg-<?php echo $wgowner['WGName']; ?> collapse-wg-working-group" id="collapse-wg-<?php echo $wgowner['WGName'] . '-' . $key; ?>">
<td class="pl-3"><?php echo $group['WGApp'] ?? "No Name"; ?></td>
<td><?php echo $group['WGRole'] ?? _txt('pl.grouperlite.value.descr.zerostate'); ?></td>
<td><?php echo $group['description'] ?? _txt('pl.grouperlite.value.descr.zerostate'); ?></td>
<td><?php echo isset($group['enabled']) && $group['enabled'] === 'T' ? 'Enabled' : 'Disabled'; ?></td>
<td class="text-center">
<span class="d-flex flex-row justify-content-center align-items-center">
<?php echo $group['optOut'] ? $this->element('GrouperLite.Components/optAction', array(
'member' => $group['optOut'],
'action' => 'leavegroup',
'group' => $group['name'],
'idx' => $key
)) : ''; ?>
<button class="btn btn-grouper btn-block btn-primary btn-sm m-1 text-nowrap members-btn" data-id="<?php echo urlencode($group['name']) ?>"><?php echo _txt('pl.grouperlite.action.members'); ?> <i class="fa fa-group"></i></button>
<?php if ($isuserowner === 'T') : ?>
<?php
$baseUrl = $grouperbaseurl;
$path = '/grouper/grouperUi/app/UiV2Main.index';
$groupOperation = '?operation=UiV2Group.viewGroup&groupId=';
$groupUrlBase = $baseUrl . $path . $groupOperation;
$attrOperation = '?operation=UiV2AttributeDefName.viewAttributeDefName&attributeDefNameId=';
$attrUrlBase = $baseUrl . $path . $attrOperation;
?>
<a href="<?php echo $groupUrlBase . $group['uuid']; ?>" class="btn btn-grouper btn-block btn-sm btn-success mt-0 text-nowrap" target="_blank" role="button">
<?php echo _txt('pl.grouperlite.action.grouper'); ?> &nbsp;
<i class="fa fa-external-link"></i>
</a>
<?php endif ?>
</span>
</td>
</tr>
<?php endforeach;*/ ?>
<?php foreach ($wggroup['Groups'] as $key => $group) : ?>
<tr class="<?php echo $collapsed ? 'collapse' : 'show'; ?> collapse-wg-working-group collapse-wg-<?php echo $wggroup['WGName']; ?>" id="collapse-wg-<?php echo $wggroup['WGName'] . '-' . $key; ?>">
<td class="pl-3"><?php echo $group['WGApp'] ?? "No Name"; ?></td>
<?php if ($isuserowner === 'T') : ?>
<td><?php echo $group['WGRole'] ?? _txt('pl.grouperlite.value.descr.zerostate'); ?></td>
<?php endif; ?>
<?php if (strpos($group['WGApp'], '@lists') !== false) : ?>
<td><?php echo _txt('pl.grouperlite.value.email'); ?></td>
<?php else : ?>
<td><?php echo _txt('pl.grouperlite.value.' . strtolower($group['WGApp'])) ?? _txt('pl.grouperlite.value.descr.zerostate'); ?></td>
<?php endif; ?>
<td><?php echo isset($group['enabled']) && $group['enabled'] === 'T' ? 'Enabled' : 'Disabled'; ?></td>
<td></td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php print $this->element("pagination", array(
'goto' => false,
Expand All @@ -214,7 +110,7 @@ $collapsed = $config['defaultCollapse'] === 'collapsed' ? true : false;
});
</script>
<?php endif; ?>
<?php if (count($groupsowners) < 1 && count($wgowners) < 1) : ?>
<?php if (count($groupsowners) < 1) : ?>
<div class="alert alert-info">
<p class="lead mb-0 text-center"><?php echo _txt('pl.grouperlite.groups.zero-state'); ?></p>
</div>
Expand Down

0 comments on commit 95145f3

Please sign in to comment.