Skip to content

Commit

Permalink
Merged BUGFIX/URLChanges into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
axel committed Mar 29, 2021
2 parents 2654b5c + 1559b0c commit 2a3b08d
Show file tree
Hide file tree
Showing 18 changed files with 66 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Controller/CoGrouperLitesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function display($id) {

$this->set('pl_grouperlite_index_url', Router::url([
'plugin' => "grouper_lite",
'controller' => 'GrouperGroups',
'controller' => 'grouper_groups',
'action' => 'index',
'co' => $this->cur_co['Co']['id'],
'glid' => $id
Expand Down
24 changes: 16 additions & 8 deletions Controller/GrouperGroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private function setConnection() {
*/
public function index() {
return $this->redirect(
array('controller' => 'GrouperGroups', 'action' => 'groupoptin')
array('controller' => 'grouper_groups', 'action' => 'groupoptin')
);
}

Expand Down Expand Up @@ -180,8 +180,8 @@ public function groupOwner() {
//Set initial settings for pagination
$scope = [
'userId' => $this->userId,
'page' => ($this->passedArgs['page'] ? $this->passedArgs['page']: $this->paginate['page']),
'limit' => ($this->passedArgs['limit'] ? $this->passedArgs['limit']: $this->paginate['limit']),
'page' => (isset($this->passedArgs['page']) ? $this->passedArgs['page']: $this->paginate['page']),
'limit' => (isset($this->passedArgs['limit']) ? $this->passedArgs['limit']: $this->paginate['limit']),
];

if (isset($this->request->data['search'])) {
Expand Down Expand Up @@ -235,8 +235,8 @@ public function groupMember() {
//Set initial settings for pagination
$scope = [
'userId' => $this->userId,
'page' => ($this->passedArgs['page'] ? $this->passedArgs['page']: $this->paginate['page']),
'limit' => ($this->passedArgs['limit'] ? $this->passedArgs['limit']: $this->paginate['limit']),
'page' => (isset($this->passedArgs['page']) ? $this->passedArgs['page']: $this->paginate['page']),
'limit' => (isset($this->passedArgs['limit']) ? $this->passedArgs['limit']: $this->paginate['limit']),
];

if (isset($this->request->data['search'])) {
Expand Down Expand Up @@ -463,9 +463,17 @@ public function leaveGroup() {
function isAuthorized() {
$roles = $this->Role->calculateCMRoles();

//Need to pull in UserID for access to Grouper
//This call just pulls in user ID from comanage but not Grouper, need the Grouper Id for API calls.
/*
if ($this->Session->check('Auth.User.username')) {
$this->userId = $this->Session->read('Auth.User.username');
}*/

if ($this->Session->check('Plugin.Grouper.UserId')) {
$this->userId = $this->Session->read('Plugin.Grouper.UserId');
} else {
$this->userId = $this->GrouperGroup->getGrouperUserId();
$this->Session->write('Plugin.Grouper.UserId', $this->userId);
}

// Determine what operations this user can perform
Expand Down Expand Up @@ -530,8 +538,8 @@ public function emaillistsMember()
//Set initial settings for pagination
$scope = [
'userId' => $this->userId,
'page' => ($this->passedArgs['page'] ? $this->passedArgs['page']: $this->paginate['page']),
'limit' => ($this->passedArgs['limit'] ? $this->passedArgs['limit']: $this->paginate['limit']),
'page' => (isset($this->passedArgs['page']) ? $this->passedArgs['page']: $this->paginate['page']),
'limit' => (isset($this->passedArgs['limit']) ? $this->passedArgs['limit']: $this->paginate['limit']),
];

try {
Expand Down
11 changes: 4 additions & 7 deletions Lib/GrouperApiAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,13 @@ public function __construct() {
}

/**
* NOT BEING USED
* Get User information from Grouper Web Service
*
* @param array $queryData Array of conditions for querying
* @return array
* @return String User ID in Grouper Groups
* @throws Exception
*/
public function getGrouperUser(array $queryData) {
public function getGrouperUserId() {

$userId = $queryData['userId'];
$this->http->setHeader(array('Content-Type' => 'application/json', 'Accept' => 'application/json'));

// Create attributes want returned from call to Grouper WS
Expand All @@ -94,7 +91,7 @@ public function getGrouperUser(array $queryData) {
'givenname'
),
'wsSubjectLookups' => array(
array('subjectIdentifier' => $userId)
array('subjectIdentifier' => $_SERVER['REMOTE_USER'])
)
)
);
Expand All @@ -114,7 +111,7 @@ public function getGrouperUser(array $queryData) {
throw $e;
}

return array();
return '';
}

/**
Expand Down
18 changes: 18 additions & 0 deletions Model/GrouperGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,24 @@ private function initApi() {
}
}

/**
* Gets the users Id from Grouper since can be different than what is in Comanage.
*
* @return String User's Id in Grouper
* @throws Exception
*/
public function getGrouperUserId() {
$this->initApi();

try {
return $this->grouperAPI->getGrouperUserId();

} catch (Exception $e) {
CakeLog::write('error', __METHOD__ . ': An error occurred');
throw $e;
}
}

/**
* Return all Groups that a User belongs to in Grouper.
* Will also add Optin Groups and flag them as joined so can display Optout option in UI.
Expand Down
12 changes: 6 additions & 6 deletions View/CoGrouperLites/display.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ echo $this->element('GrouperLite.base-styles');
<a class="btn btn-primary" href="<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'GrouperGroups',
'controller' => 'grouper_groups',
'action' => 'groupoptin',
'co' => $coid,
'glid' => $glid
Expand All @@ -64,7 +64,7 @@ echo $this->element('GrouperLite.base-styles');
<a class="btn btn-primary mt-1" href="<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'GrouperGroups',
'controller' => 'grouper_groups',
'action' => 'groupmember',
'co' => $coid,
'glid' => $glid
Expand All @@ -76,7 +76,7 @@ echo $this->element('GrouperLite.base-styles');
<a class="btn btn-primary mt-1" href="<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'GrouperGroups',
'controller' => 'grouper_groups',
'action' => 'groupowner',
'co' => $coid,
'glid' => $glid
Expand All @@ -93,7 +93,7 @@ echo $this->element('GrouperLite.base-styles');
<a class="btn btn-secondary" href="<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'GrouperGroups',
'controller' => 'grouper_groups',
'action' => 'emaillistsoptin',
'co' => $coid,
'glid' => $glid
Expand All @@ -104,7 +104,7 @@ echo $this->element('GrouperLite.base-styles');
<a class="btn btn-secondary mt-1" href="<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'GrouperGroups',
'controller' => 'grouper_groups',
'action' => 'emaillistsMember',
'co' => $coid,
'glid' => $glid
Expand All @@ -116,7 +116,7 @@ echo $this->element('GrouperLite.base-styles');
<a class="btn btn-secondary mt-1" href="<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'GrouperGroups',
'controller' => 'grouper_groups',
'action' => 'emaillistsManage',
'co' => $coid,
'glid' => $glid
Expand Down
10 changes: 5 additions & 5 deletions View/Elements/Components/navigation-emaillists.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
print $this->Html->link(
_txt('pl.grouperlite.nav.emaillists-join'),
array(
'controller' => 'GrouperGroups',
'controller' => 'grouper_groups',
'action' => 'emaillistsoptin'
),
array('class' => array('nav-link', $active == 'emaillistsoptin' ? 'active' : ''))
Expand All @@ -17,7 +17,7 @@
print $this->Html->link(
_txt('pl.grouperlite.nav.emaillists-member'),
array(
'controller' => 'GrouperGroups',
'controller' => 'grouper_groups',
'action' => 'emaillistsmember'
),
array('class' => array('nav-link', $active == 'emaillistsmember' ? 'active' : ''))
Expand All @@ -29,7 +29,7 @@
print $this->Html->link(
_txt('pl.grouperlite.nav.emaillists-manage'),
array(
'controller' => 'GrouperGroups',
'controller' => 'grouper_groups',
'action' => 'emaillistsmanage'
),
array('class' => array('nav-link', $active == 'emaillistsmanage' ? 'active' : ''))
Expand All @@ -42,7 +42,7 @@
<?php
$createEmailUrl = $this->Html->url(
array(
'controller' => 'groupergroups',
'controller' => 'grouper_groups',
'action' => 'groupcreatetemplateform'
)
);
Expand All @@ -56,7 +56,7 @@
<?php
$gotoGroupsUrl = $this->Html->url(
array(
'controller' => 'groupergroups',
'controller' => 'grouper_groups',
'action' => 'groupoptin'
)
);
Expand Down
10 changes: 5 additions & 5 deletions View/Elements/Components/navigation-groups.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
print $this->Html->link(
_txt('pl.grouperlite.nav.groups-can-join'),
array(
'controller' => 'groupergroups',
'controller' => 'grouper_groups',
'action' => 'groupoptin'
),
array('class' => array('nav-link', $active == 'groupoptin' ? 'active' : ''))
Expand All @@ -17,7 +17,7 @@
print $this->Html->link(
_txt('pl.grouperlite.nav.memberships'),
array(
'controller' => 'groupergroups',
'controller' => 'grouper_groups',
'action' => 'groupmember'
),
array('class' => array('nav-link', $active == 'groupmember' ? 'active' : ''))
Expand All @@ -29,7 +29,7 @@
print $this->Html->link(
_txt('pl.grouperlite.nav.groups-presided'),
array(
'controller' => 'groupergroups',
'controller' => 'grouper_groups',
'action' => 'groupowner'
),
array('class' => array('nav-link', $active == 'groupowner' ? 'active' : ''))
Expand All @@ -42,7 +42,7 @@
<?php
$createGroupUrl = $this->Html->url(
array(
'controller' => 'groupergroups',
'controller' => 'grouper_groups',
'action' => 'groupcreateform'
)
);
Expand All @@ -56,7 +56,7 @@
<?php
$gotoEmailListsUrl = $this->Html->url(
array(
'controller' => 'groupergroups',
'controller' => 'grouper_groups',
'action' => 'emaillistsoptin'
)
);
Expand Down
2 changes: 1 addition & 1 deletion View/Elements/Components/optAction.ctp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php echo $this->Form->create(false, array(
'url' => array('controller' => 'groupergroups', 'action' => $action),
'url' => array('controller' => 'grouper_groups', 'action' => $action),
'class' => 'd-flex justify-content-center'
)); ?>
<?php print $this->Form->hidden('GroupName', array('default' => $group)); ?>
Expand Down
2 changes: 1 addition & 1 deletion View/Elements/Components/search.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
});
</script>
<?php echo $this->Form->create(false, array(
'url' => array('controller' => 'groupergroups', 'action' => $active),
'url' => array('controller' => 'grouper_groups', 'action' => $active),
'class' => 'search mb-4'
)); ?>
<div id="search-grouper-form">
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/base.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ print $this->Html->css('GrouperLite.co-grouper-plugin') . "\n ";
<?php /* only JQuery here - other scripts at bottom */
print $this->Html->script('GrouperLite.typeahead.bundle.js') . "\n ";

$this->Html->addCrumb(_txt('pl.grouperlite.crumb.root'), array('controller' => 'groupergroups', 'action' => 'groupoptin'), array('prepend' => true));
$this->Html->addCrumb(_txt('pl.grouperlite.crumb.root'), array('controller' => 'grouper_groups', 'action' => 'groupoptin'), array('prepend' => true));
?>

<div id="grouper-plugin" class="grouper pt-2">
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/emaillistsmanage.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<td><?php echo $this->Html->link(
isset($group['name']) ? $group['domain'] . ':' . $group['name'] : "--",
array(
'controller' => 'groupergroups',
'controller' => 'grouper_groups',
'action' => 'emaillistinfo',
'?' => array('groupname' => urlencode($group['name']))
)
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/emaillistsmember.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<td><?php echo $this->Html->link(
isset($group['name']) ? $group['domain'].':'.$group['name'] : "No Name",
array(
'controller' => 'groupergroups',
'controller' => 'grouper_groups',
'action' => 'emaillistinfo',
'?' => array('groupname' => urlencode($group['name']))
)
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/emaillistsoptin.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<td><?php echo $this->Html->link(
isset($group['name']) ? $group['domain'] . ':' . $group['name'] : "No Name",
array(
'controller' => 'groupergroups',
'controller' => 'grouper_groups',
'action' => 'emaillistinfo',
'?' => array('groupname' => urlencode($group['name']))
)
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/groupcreate.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $model = $this->name;
<?php endforeach; ?>

<?php echo $this->Form->create(false, array(
'url' => array('controller' => 'groupergroups', 'action' => 'groupcreate')
'url' => array('controller' => 'grouper_groups', 'action' => 'groupcreate')
)); ?>
<?php
if (!empty($this->plugin)) {
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/groupcreatetemplate.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $model = $this->name;
<div class="col-lg-9 col-xs-12 col-xl-6">
<div class="create-group">
<?php echo $this->Form->create(false, array(
'url' => array('controller' => 'groupergroups', 'action' => 'groupcreatetemplate')
'url' => array('controller' => 'grouper_groups', 'action' => 'groupcreatetemplate')
)); ?>
<?php
if (!empty($this->plugin)) {
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/groupmember.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<tr>
<td><a href="<?php echo $this->Html->url(
array(
'controller' => 'groupergroups',
'controller' => 'grouper_groups',
'action' => 'groupinfo',
'?' => array('groupname' => urlencode($group['name']))
)
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/groupoptin.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<tr>
<td><a href="<?php echo $this->Html->url(
array(
'controller' => 'groupergroups',
'controller' => 'grouper_groups',
'action' => 'groupinfo',
'?' => array('groupname' => urlencode($group['name']))
)
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/groupowner.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<tr>
<td><a href="<?php echo $this->Html->url(
array(
'controller' => 'groupergroups',
'controller' => 'grouper_groups',
'action' => 'groupinfo',
'?' => array('groupname' => urlencode($group['name']))
)
Expand Down

0 comments on commit 2a3b08d

Please sign in to comment.