diff --git a/Controller/GrouperGroupsController.php b/Controller/GrouperGroupsController.php index 301b045..af237b7 100644 --- a/Controller/GrouperGroupsController.php +++ b/Controller/GrouperGroupsController.php @@ -46,15 +46,6 @@ class GrouperGroupsController extends GrouperLiteAppController public $name = 'GrouperGroups'; - //Unfortunately we cannot go below 20 since that is the default and if change to below 20 will not show - //page navigation unless change record count and go back to lower number on Display record selection!! Sucks! - public $paginate = array( - //Default records per page. - 'limit' => 20, - 'maxlimit' => 100, - 'page' => 1 - ); - /** * Overrides parent beforeFilter to verify that Session contains the correct API settings. * @@ -135,6 +126,32 @@ public function index() $this->set('config', $config); } + /** + * Gets basic configuration for user/app via AJAX call access + * @return void + */ + public function getBaseConfig() { + + if ($this->request->is('ajax')) { + $this->response->disableCache(); + } + + $config = [ + "grouperbaseurl" => $this->Session->read('Plugin.Grouper.Api.grouperUrl'), + "isuserowner" => $this->GrouperGroup->isUserOwner($this->userId), + "isTemplateUser" => $this->GrouperGroup->isTemplateUser($this->userId), + "isGrouperVisible" => $this->GrouperGroup->isGrouperVisible($this->userId), + "defaultCollapse" => CakeSession::read('Plugin.Grouper.Api.defaultCollapse'), + "adHocHeading" => CakeSession::read('Plugin.Grouper.Api.adHocHeading'), + "wgHeading" => CakeSession::read('Plugin.Grouper.Api.wgHeading'), + 'co' => CakeSession::read('Plugin.Grouper.Api.co') + ]; + + $this->response->type('json'); + $this->set(compact('config')); + $this->set('_serialize', 'config'); + } + /** * Show all members of a group @@ -169,6 +186,7 @@ public function groupSubscribers() $this->Flash->set(_txt('pl.grouperlite.message.flash.group-detail-members-failed'), array('key' => 'error')); } + if(count($subscribers) < 1){ $this->response->type('json'); $this->response->statusCode(404); @@ -414,21 +432,17 @@ public function removeSubscriber() */ public function groupOwner() { - $this->set('title', _txt('pl.grouperlite.title.groupowner')); + if ($this->request->is('ajax')) { + $this->response->disableCache(); + } - //Set initial settings for pagination + //Set initial setting $scope = [ - 'userId' => $this->userId, - 'page' => ($this->passedArgs['page'] ?? $this->paginate['page']), - 'limit' => ($this->passedArgs['limit'] ?? $this->paginate['limit']), + 'userId' => $this->userId ]; - if (isset($this->request->data['search']) || isset($this->request->query['search'])) { - if(isset($this->request->data['search'])){ - $searchCriteria = urldecode($this->request->data['search']); - } else { - $searchCriteria = urldecode($this->request->query['search']); - } + if (isset($this->request->query['search'])) { + $searchCriteria = urldecode($this->request->query['search']); $this->set('searchcriteria', $searchCriteria); @@ -438,14 +452,15 @@ public function groupOwner() $scope['searchcriteria'] = $searchCriteria; $scope['searchpage'] = 'ownerGroups'; - $data = $this->Paginator->paginate('GrouperGroup', $scope); - - $this->set('groupsowners', $data); + $groupowners = $this->GrouperGroup->getSearchedGroups($scope); } catch (Exception $e) { CakeLog::write('error', __METHOD__ . ' Search: ' . var_export($e->getMessage(), true)); - + $this->response->type('json'); + $this->response->statusCode(500); + $this->response->send(); $this->set('groupsowners', array()); + $this->Flash->set(_txt('pl.grouperlite.message.flash.owner-group-failed'), array('key' => 'error')); return; } @@ -453,32 +468,21 @@ public function groupOwner() try { $scope['method'] = 'ownerGroups'; - $data = $this->Paginator->paginate('GrouperGroup', $scope); - - $this->set('groupsowners', $data); + $groupowners = $this->GrouperGroup->ownerGroups($scope); } catch (Exception $e) { CakeLog::write('error', __METHOD__ . ': ' . var_export($e->getMessage(), true)); - + $this->response->type('json'); + $this->response->statusCode(500); + $this->response->send(); $this->set('groupsowners', array()); - $this->set('wgowners', array()); + $this->Flash->set(_txt('pl.grouperlite.message.flash.owner-group-failed'), array('key' => 'error')); return; } - } - - $this->set('grouperbaseurl', $this->Session->read('Plugin.Grouper.Api.grouperUrl')); - $this->set('isuserowner', $this->GrouperGroup->isUserOwner($this->userId)); - $this->set('isTemplateUser', $this->GrouperGroup->isTemplateUser($this->userId)); - $this->set('isGrouperVisible', $this->GrouperGroup->isGrouperVisible($this->userId)); - $config = [ - "defaultCollapse" => CakeSession::read('Plugin.Grouper.Api.defaultCollapse'), - "adHocHeading" => CakeSession::read('Plugin.Grouper.Api.adHocHeading'), - "wgHeading" => CakeSession::read('Plugin.Grouper.Api.wgHeading'), - 'co' => CakeSession::read('Plugin.Grouper.Api.co') - ]; - $this->set('config', $config); + $this->set(compact('groupowners')); + $this->set('_serialize', 'groupowners'); } /** @@ -489,13 +493,9 @@ public function groupOwner() public function groupMember() { - $this->set('title', _txt('pl.grouperlite.title.groupmember')); - - //Set initial settings for pagination + //Set initial setting $scope = [ - 'userId' => $this->userId, - 'page' => ($this->passedArgs['page'] ?? $this->paginate['page']), - 'limit' => ($this->passedArgs['limit'] ?? $this->paginate['limit']), + 'userId' => $this->userId ]; if (isset($this->request->data['search']) || isset($this->request->query['search'])) { @@ -514,7 +514,7 @@ public function groupMember() $scope['searchpage'] = 'filteredMemberOfGroups'; $scope['ContainsWG'] = true; - $data = $this->Paginator->paginate('GrouperGroup', $scope); + $data = $this->GrouperGroup->getSearchedGroups($scope); $finalData = $this->breakoutGroups($data); @@ -534,7 +534,7 @@ public function groupMember() //Add setting for Group Membership $scope['method'] = 'filteredMemberOfGroups'; - $data = $this->Paginator->paginate('GrouperGroup', $scope); + $data = $this->GrouperGroup->filteredMemberOfGroups($scope); $finalData = $this->breakoutGroups($data); @@ -568,14 +568,10 @@ public function groupMember() */ public function groupOptin() { - $this->set('title', _txt('pl.grouperlite.title.groupoptin')); - - //Set initial settings for pagination + //Set initial setting $scope = [ - 'userId' => $this->userId, - 'page' => ($this->passedArgs['page'] ?? $this->paginate['page']), - 'limit' => ($this->passedArgs['limit'] ?? $this->paginate['limit']), + 'userId' => $this->userId ]; if (isset($this->request->data['search']) || isset($this->request->query['search'])) { @@ -593,7 +589,7 @@ public function groupOptin() $scope['searchcriteria'] = $searchCriteria; $scope['searchpage'] = 'optinGroups'; - $data = $this->Paginator->paginate('GrouperGroup', $scope); + $data = $this->GrouperGroup->getSearchedGroups($scope); $this->set('groupoptins', $data); @@ -610,7 +606,7 @@ public function groupOptin() //Add settings for optinGroups $scope['method'] = 'optinGroups'; - $data = $this->Paginator->paginate('GrouperGroup', $scope); + $data = $this->GrouperGroup->optinGroups($scope); $this->set('groupoptins', $data); @@ -634,6 +630,7 @@ public function groupOptin() $this->set('config', $config); } + /** * Create a new Grouper Group via Grouper Template * Note: This is tightly coupled code to requirements, so view is hardcoded to reflect current reqs. Will need @@ -663,61 +660,6 @@ public function groupCreateTemplate() $this->set('title', _txt('pl.grouperlite.title.templatecreate')); } - /** - * ======================== NOT BEING USED ======================== - * - * Delete a Grouper Group via Grouper Template - */ - public function groupDeleteTemplate() - { - if (!$this->GrouperGroup->deleteGroupWithTemplate($this->userId, $this->request->data)) { - $this->Flash->set("Error in deleting group!", array('key' => 'error')); - return $this->redirect(array('action' => 'groupoptin')); - } - - $this->set('title', _txt('pl.grouperlite.title.templatecreate')); - } - - /** - * ======================== NOT BEING USED ======================== - * - * @return CakeResponse|void|null - * @deprecated - * - */ - public function groupCreate() - { - if ($this->request->is('post')) { - if (!$this->GrouperGroup->createUpdateGroup($this->userId, $this->request->data)) { - $this->Flash->set("Error in creating group!", array('key' => 'error')); - } else { - $this->Flash->set("Your Group has been created!", array('key' => 'success')); - } - return $this->redirect(array('action' => 'groupOwner')); - } - - $this->set('title', _txt('pl.grouperlite.title.groupcreate')); - $this->set('grouperstems', $this->GrouperGroup->getOwnedStems($this->userId)); - } - - - /** - * ======================== NOT BEING USED ======================== - * - * @return CakeResponse|null - */ - public function groupDelete() - { - if (!$this->GrouperGroup->deleteGroup($this->userId, $this->request->data)) { - $this->Flash->set("Error in deleting group!", array('key' => 'error')); - } else { - $this->Flash->set("Your Group has been deleted!", array('key' => 'success')); - } - - $this->set('grouperstems', $this->GrouperGroup->getOwnedStems($this->userId)); - return $this->redirect(array('action' => 'groupOwner')); - } - /** * Process to join a group displayed on the "Optin" page @@ -799,6 +741,8 @@ function isAuthorized() //TODO - This is needed for my dev enviro since I do not log in via I2 IdP // BEGIN =============================================== + + if ($this->Session->check('Auth.User.username')) { $this->userId = $this->Session->read('Auth.User.username'); } @@ -848,6 +792,7 @@ function isAuthorized() $this->userId = $this->getUserId($uid); $this->Session->write('Plugin.Grouper.UserId', $this->userId); } + // END =============================================== */ @@ -857,20 +802,16 @@ function isAuthorized() $p = array(); $p['index'] = true; - $p['groupinfo'] = true; $p['membersingroup'] = true; $p['groupowner'] = true; $p['groupmember'] = true; + $p['getBaseConfig'] = true; $p['groupSubscribers'] = true; $p['addSubscriber'] = true; $p['findSubscriber'] = true; $p['removeSubscriber'] = true; $p['groupoptin'] = true; - $p['emaillistsoptin'] = true; - $p['emaillistsmember'] = true; - $p['emaillistsmanage'] = true; $p['groupcreate'] = true; - $p['groupdelete'] = true; $p['joingroup'] = true; $p['leavegroup'] = true; $p['groupcreatetemplate'] = true; @@ -880,137 +821,6 @@ function isAuthorized() return ($p[$this->action]); } - public function emaillistsOptin() - { - $this->set('title', _txt('pl.grouperlite.title.emaillists-join')); - - //Set initial settings for pagination - $scope = [ - 'userId' => $this->userId, - 'page' => ($this->passedArgs['page'] ?? $this->paginate['page']), - 'limit' => ($this->passedArgs['limit'] ?? $this->paginate['limit']), - ]; - - if (isset($this->request->data['search'])) { - $searchCriteria = urldecode($this->request->data['search']); - $this->set('searchcriteria', $searchCriteria); - - try { - //Add setting for Group Membership - $scope['method'] = 'getSearchedGroups'; - $scope['searchcriteria'] = $searchCriteria; - $scope['searchpage'] = 'optinEmailGroups'; - $scope['emailonly'] = true; - - $data = $this->Paginator->paginate('GrouperGroup', $scope); - - $this->set('emailgroups', $data); - - } catch (Exception $e) { - CakeLog::write('error', __METHOD__ . ' Search: ' . var_export($e->getMessage(), true)); - - $this->Flash->set("Your Email Optin List cannot be found, please try again later.", array('key' => 'error')); - $this->set('emailgroups', array()); - return; - } - } else { - try { - //Add setting for Group Membership - $scope['method'] = 'optinEmailGroups'; - $scope['emailonly'] = true; - - $data = $this->Paginator->paginate('GrouperGroup', $scope); - - $this->set('emailgroups', $data); - - } catch (Exception $e) { - CakeLog::write('error', __METHOD__ . ' Search: ' . var_export($e->getMessage(), true)); - - $this->Flash->set("An error occurred with the Optin Email Lists, please try again later.", array('key' => 'error')); - $this->set('emailgroups', array()); - return; - } - } - - $this->set('isuserowner', $this->GrouperGroup->isUserOwner($this->userId)); - $this->set('isTemplateUser', $this->GrouperGroup->isTemplateUser($this->userId)); - $this->set('isGrouperVisible', $this->GrouperGroup->isGrouperVisible($this->userId)); - } - - public function emaillistsMember() - { - $this->set('title', _txt('pl.grouperlite.title.emaillists-member')); - - //Set initial settings for pagination - $scope = [ - 'userId' => $this->userId, - 'page' => ($this->passedArgs['page'] ?? $this->paginate['page']), - 'limit' => ($this->passedArgs['limit'] ?? $this->paginate['limit']), - ]; - - if (isset($this->request->data['search'])) { - $searchCriteria = urldecode($this->request->data['search']); - $this->set('searchcriteria', $searchCriteria); - - try { - //Add setting for Group Membership - $scope['method'] = 'getSearchedGroups'; - $scope['searchcriteria'] = $searchCriteria; - $scope['searchpage'] = 'filteredMemberOfEmails'; - $scope['emailonly'] = true; - - $data = $this->Paginator->paginate('GrouperGroup', $scope); - - $this->set('emailgroups', $data); - - } catch (Exception $e) { - CakeLog::write('error', __METHOD__ . ' Search: ' . var_export($e->getMessage(), true)); - - $this->Flash->set("Your Email Group cannot be found, please try again later.", array('key' => 'error')); - $this->set('emailgroups', array()); - return; - } - } else { - try { - //Add setting for Group Membership - $scope['method'] = 'filteredMemberOfEmails'; - $scope['emailonly'] = true; - - $data = $this->Paginator->paginate('GrouperGroup', $scope); - - $this->set('emailgroups', $data); - - } catch (Exception $e) { - CakeLog::write('error', __METHOD__ . ' Search: ' . var_export($e->getMessage(), true)); - - $this->Flash->set("Your Email Group cannot be found, please try again later.", array('key' => 'error')); - $this->set('emailgroups', array()); - return; - } - } - - $this->set('isuserowner', $this->GrouperGroup->isUserOwner($this->userId)); - $this->set('isTemplateUser', $this->GrouperGroup->isTemplateUser($this->userId)); - $this->set('isGrouperVisible', $this->GrouperGroup->isGrouperVisible($this->userId)); - } - - public function emaillistsManage() - { - $this->set('title', _txt('pl.grouperlite.title.emaillists-manage')); - // mock data - $this->set('group', array( - 'member' => true, - 'name' => 'Email List 1', - 'domain' => 'internet2', - 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', - 'enabled' => 'T' - )); - - $this->set('isuserowner', $this->GrouperGroup->isUserOwner($this->userId)); - $this->set('isTemplateUser', $this->GrouperGroup->isTemplateUser($this->userId)); - $this->set('isGrouperVisible', $this->GrouperGroup->isGrouperVisible($this->userId)); - } - private function getUserId($id) { @@ -1054,21 +864,5 @@ private function breakoutGroups(array $recordSet, $type = 'basic') ); } - /** - * Eliminating canned description added by Grouper on creation of a WG in Grouper - * - * @param $description - * @return string - * - */ - private function hackDescription($description) - { - //Verify description has period in it. - if (strpos($description, ".") === false) { - return $description; - } - $newString = substr($description, strpos($description, ".") + 1); - return trim($newString); - } } \ No newline at end of file diff --git a/Model/GrouperGroup.php b/Model/GrouperGroup.php index 2a390d1..90ee0f7 100644 --- a/Model/GrouperGroup.php +++ b/Model/GrouperGroup.php @@ -171,6 +171,7 @@ private function initApi() } /** + * NOT BEING USED * Listing of members in an email group * * @param array $conditions Listing of conditions for display of records, including UserId @@ -178,27 +179,27 @@ private function initApi() * @throws GrouperLiteException * */ - public function filteredMemberOfEmails(array $conditions) - { - $this->initApi(); - - try { - $memberOfEmails = $this->filteredMemberOfGroups($conditions); - - // Strip out all Groups that are not in app:sympa Stem/Directory - foreach ($memberOfEmails as $key => $value) { - if (strpos(strtolower($value['name']), $this->emailStem) === false) { - unset($memberOfEmails[$key]); - } - } - return array_values($memberOfEmails); - - } catch (Exception $e) { - CakeLog::write('error', __METHOD__ . ': An error occurred'); - throw $e; - } - - } +// public function filteredMemberOfEmails(array $conditions) +// { +// $this->initApi(); +// +// try { +// $memberOfEmails = $this->filteredMemberOfGroups($conditions); +// +// // Strip out all Groups that are not in app:sympa Stem/Directory +// foreach ($memberOfEmails as $key => $value) { +// if (strpos(strtolower($value['name']), $this->emailStem) === false) { +// unset($memberOfEmails[$key]); +// } +// } +// return array_values($memberOfEmails); +// +// } catch (Exception $e) { +// CakeLog::write('error', __METHOD__ . ': An error occurred'); +// throw $e; +// } +// +// } /** * Return all Groups that a User belongs to in Grouper. @@ -234,7 +235,8 @@ public function filteredMemberOfGroups(array $conditions) } } - return array_values($memberOfGroups); + $groupResults = array_values($memberOfGroups); + return $this->getFriendlyWorkingGroupName($groupResults, 'member'); } catch (Exception $e) { CakeLog::write('error', __METHOD__ . ': An error occurred'); @@ -330,7 +332,8 @@ public function ownerGroups(array $conditions) $this->initApi(); try { - return $this->grouperAPI->getOwnedGroups($conditions); + $resultSet = $this->grouperAPI->getOwnedGroups($conditions); + return $this->getFriendlyName(array_values($resultSet)); } catch (Exception $e) { CakeLog::write('error', __METHOD__ . ': An error occurred'); @@ -460,9 +463,8 @@ public function optinGroups(array $conditions) } } } - //$finalSet = $this->paginateRecords($joinOrLeave, $conditions); - return array_values($joinOrLeave); + return $this->getFriendlyName(array_values($joinOrLeave)); } catch (Exception $e) { CakeLog::write('error', __METHOD__ . ': An error occurred'); @@ -600,56 +602,19 @@ public function getSearchedGroups(array $conditions) } } - return $returnResults; - - } catch (Exception $e) { - CakeLog::write('error', __METHOD__ . ': An error occurred'); - throw $e; - } - } - - /** - * Method needed to support Pagination - * Adjusted to fit the data source being the Grouper API vs DB calls - * - * @param array $conditions Listing of conditions for display of records with pagination - * @return array Records requested by user with pagination support - * @throws Exception Captured in Controller - * - */ - public function paginate($conditions) - { - try { - //Pull out the method that should be run. - $method = $conditions['method']; - - $resultSet = $this->$method($conditions); - - if (isset($conditions['emailonly']) && $conditions['emailonly']) { - if ($method == 'getSearchedGroups' || $method == 'filteredMemberOfEmails') { - $friendlyResults = $this->getFriendlyEmailName($resultSet, 'member'); - } else { - $friendlyResults = $this->getFriendlyEmailName($resultSet, ''); - } - + if(isset($conditions['']) && $conditions['getSearchedGroups']){ + return $this->getFriendlyWorkingGroupName($returnResults, 'member'); } else { - if (isset($conditions['ContainsWG']) && $method == 'getSearchedGroups') { - $friendlyResults = $this->getFriendlyWorkingGroupName($resultSet, 'member'); - } elseif ($method == 'filteredMemberOfGroups') { - $friendlyResults = $this->getFriendlyWorkingGroupName($resultSet, 'member'); - } else { - $friendlyResults = $this->getFriendlyName(array_values($resultSet)); - } + return $returnResults; } - return $this->paginateRecords($friendlyResults, $conditions); } catch (Exception $e) { CakeLog::write('error', __METHOD__ . ': An error occurred'); throw $e; } - } + /** * Return array of Working Groups for display on coManage site. * Logic is for each WG to have one key=>value of main WG name, then array of all associated @@ -812,238 +777,4 @@ private function getFriendlyName(array $groups) return $groups; } - /** - * Parses returned records to display only requested records for pagination. - * - * @param array $recSet All Grouper Records associated to User's request - * @param array $conditions Listing of conditions for display of records with pagination - * @return array Records requested by user with pagination support - * - */ - private function paginateRecords(array $recSet, array $conditions) - { - - //set for pagination record count - $this->totalRecords = count($recSet); - - //Return all, if requested - if (strtolower($conditions['limit']) == 'all') { - return $recSet; - } - - //Now slice recordset to return correct set of records. - $page = $conditions['page'] - 1; - $limit = $conditions['limit']; - if ($page == 0) { - $start = 0; - } else { - $start = $page * $limit; - } - $end = $start + $limit; - - return array_slice($recSet, $start, $end); - } - - /** - * Needed method to support Cake's pagination in the views - * - * @param null $conditions Listing of conditions for display of records with pagination - * @param int $recursive - * @param array $extra - * @return int Total number of Grouper Records returned by Grouper API call - * - */ - public function paginateCount($conditions = null, $recursive = 0, $extra = array()) - { - return $this->totalRecords; - } - - /** - * ======================== NOT BEING USED ======================== - * - * This is specifically for email listings only tabs/pages, that are now not being used. - * - * Process that parses the email list and makes it more user friendly - * @lists. - * - * @param array $groups - Array of email lists - * @param $method - User who is accessing, if plain member remove admin and owner email lists. - * @return array - Array of friendly email lists - */ - private function getFriendlyEmailName(array $groups, $method) - { - - $arrayIndex = 0; - foreach ($groups as &$group) { - if ($method == 'member') { - if ($group['extension'] == 'admins' || $group['extension'] == 'owners') { - unset($groups[$arrayIndex]); - } - } - $stems = explode(':', $group['name']); - $sectionCount = count($stems) - 2; - $groupName = $stems[$sectionCount]; - $domain = $stems[2]; - if (strtolower($domain) == 'incommon') { - $address = $groupName . '@lists.incommon.org'; - } elseif (strtolower($domain) == 'internet2') { - $address = $groupName . '@lists.internet2.edu'; - } else { - $address = $groupName . '@lists.' . strtolower($domain) . '.org'; - } - $group['friendlyEmail'] = $address; - $arrayIndex += 1; - } - return $groups; - } - - /** - * ======================== NOT BEING USED ======================== - * - * Used to be used for Grouper group information page. leaving in case want to reincorporate. - * - * Gets the Grouper Groups params and values as well as its associated attributes. - * - * @param string $groupName Name of Group, do not confuse with DisplayName field! - * @return array A set of attributes associated to a specific Grouper Group - * @throws GrouperLiteException - */ - public function groupDescriptions(string $groupName) - { - $this->initApi(); - - try { - $args = array(); - $args['groupName'] = $groupName; - - $groupDescription = $this->grouperAPI->getGrouperGroupInfo($args); - $groupDescription[0]['friendlyName'] = $groupDescription[0]['displayName']; - - return $groupDescription; - - } catch (Exception $e) { - CakeLog::write('error', __METHOD__ . ': An error occurred'); - throw $e; - } - - } - - /** - * ======================== NOT BEING USED ======================== - * - * List of Email Groups a user can opt into. - * - * @param array $conditions Listing of conditions for display of records, including UserId - * @return array Listing of Optin email groups available in Groupe - * @throws GrouperLiteException Captured in Controller - * - */ - public function optinEmailGroups(array $conditions) - { - $this->initApi(); - - try { - $allGroups = $this->optinGroups($conditions); - - // Strip out all Groups that are not in Sympa Stem/Directory - foreach ($allGroups as $key => $value) { - if (strpos($value['name'], $this->emailStem) === false) { - unset($allGroups[$key]); - } - } - - return array_values($allGroups); - - } catch (Exception $e) { - CakeLog::write('error', __METHOD__ . ': An error occurred'); - throw $e; - } - } - - /** - * ======================== NOT BEING USED ======================== - * - * Delete a Grouper Group using the Template methodology in Grouper - * - * @param string $userId Id of User - * @param array $groupData Data needed to delete a Grouper Group via Template - * @return bool True if successfully deleted record - * @throws GrouperLiteException - * - */ - public function deleteGroupWithTemplate(string $userId, array $groupData) - { - $this->initApi(); - - try { - $args = array(); - $args['userId'] = $userId; - $args['workingGroupExt'] = $groupData['workingGroupExt']; - - // Reset Session variable that shows if User is an owner or not - $this->resetUserOwner(); - - return $this->grouperAPI->deleteGroupWithTemplate($args); - - } catch (Exception $e) { - CakeLog::write('error', __METHOD__ . ': An error occurred'); - throw $e; - } - - } - - /** - * ======================== NOT BEING USED ======================== - * - * Creates/Updates a new Grouper Group not WG Template related - * - * @param string $userId Id of user - * @param array $data Data from form to Save in Grouper as a Group - * @return bool True if saved | False if already created - * @throws GrouperLiteException - * - */ - public function createUpdateGroup(string $userId, array $data) - { - $this->initApi(); - - try { - $args = $data; - $args['userId'] = $userId; - - // Reset Session variable that shows if User is an owner or not - $this->resetUserOwner(); - - return $this->grouperAPI->createUpdateGroup($args); - - } catch (Exception $e) { - CakeLog::write('error', __METHOD__ . ': An error occurred'); - throw $e; - } - } - - /** - * ======================== NOT BEING USED ======================== - * - * Get Grouper Stems where User has authority to create a Grouper Group - * - * @param string $userId Id of User - * @return array Stem records - * @throws GrouperLiteException - */ - public function getOwnedStems(string $userId) - { - $this->initApi(); - - try { - $args = array(); - $args['userId'] = $userId; - - return $this->grouperAPI->getOwnedStems($args); - - } catch (Exception $e) { - CakeLog::write('error', __METHOD__ . ': An error occurred'); - throw $e; - } - } }