diff --git a/Controller/GrouperGroupsController.php b/Controller/GrouperGroupsController.php index d7bb129..68b8ed5 100644 --- a/Controller/GrouperGroupsController.php +++ b/Controller/GrouperGroupsController.php @@ -106,18 +106,7 @@ public function beforeFilter() HttpStatusCodesEnum::HTTP_BAD_REQUEST); } - $this->Security->unlockedActions = array( - 'removeSubscriber', - 'addSubscriber', - 'joinGroup', - 'leaveGroup', - 'groupMember', - 'groupOptin', - 'groupOwner' - ); - if ($this->request->is('ajax')) { - $this->response->disableCache(); $this->RequestHandler->addInputType('json', array('json_decode', true)); } diff --git a/Lib/GrouperApiAccess.php b/Lib/GrouperApiAccess.php index c1750fd..3eb5c40 100644 --- a/Lib/GrouperApiAccess.php +++ b/Lib/GrouperApiAccess.php @@ -371,6 +371,8 @@ public function getGroupInfo(string $groupName): array /** * Returns all the groups the active user is a member of, that they are allowed to see. * + * THIS REQUEST TARGETS THE GROUPS ENDPOINT + * * Note: Params added at end make sure that the groups returned can only be viewed by the member logged into * Grouper Lite * @@ -381,7 +383,7 @@ public function getGroupInfo(string $groupName): array * * @throws GrouperLiteWidgetException */ - public function getUserGroupMemberships(string $actorUserId, string $userId): array + public function getUserGroups(string $actorUserId, string $userId): array { if(empty($userId)) { return []; @@ -404,6 +406,8 @@ public function getUserGroupMemberships(string $actorUserId, string $userId): ar * Returns either the groups the user is able to Opt into or can manage the memberships of. * Used for requests made to Membership endpoint in Grouper WS * + * THIS REQUEST TARGETS THE MEMBERSHIP ENDPOINT + * * @param string $userId * @param string $actAsUserId * @param string $groupType @@ -439,7 +443,7 @@ public function getUserGroupMemberships(string $actorUserId, string $userId): ar * } * } */ - public function getGrouperUserMemberships(string $userId, string $actAsUserId, string $groupType): array + public function getUserMemberships(string $userId, string $actAsUserId, string $groupType): array { if(!in_array($groupType, [ GrouperGroupTypeEnum::OPTINS, diff --git a/Model/GrouperGroup.php b/Model/GrouperGroup.php index 97c22de..5420743 100644 --- a/Model/GrouperGroup.php +++ b/Model/GrouperGroup.php @@ -79,8 +79,8 @@ public function isUserGroupOwner(string $userId, array $cfg): bool } try { - $resultsAdmin = $this->grouperAPI->getGrouperUserMemberships($userId, $userId, GrouperGroupTypeEnum::ADMIN); - $resultsUpdate = $this->grouperAPI->getGrouperUserMemberships($userId, $userId, GrouperGroupTypeEnum::UPDATE); + $resultsAdmin = $this->grouperAPI->getUserMemberships($userId, $userId, GrouperGroupTypeEnum::ADMIN); + $resultsUpdate = $this->grouperAPI->getUserMemberships($userId, $userId, GrouperGroupTypeEnum::UPDATE); } catch (Exception $e) { CakeLog::write('error', __METHOD__ . ': An error occurred'); throw $e; @@ -144,7 +144,7 @@ public function filteredMemberOfGroups(string $userId, array $cfg): array try { $memberOfGroups = $this->memberOfGroups($userId, $userId, $cfg); // Determine which groups can be left by user, if wanted. - $optOutGroups = $this->grouperAPI->getGrouperUserMemberships($userId, $userId, GrouperGroupTypeEnum::OPTOUTS); + $optOutGroups = $this->grouperAPI->getUserMemberships($userId, $userId, GrouperGroupTypeEnum::OPTOUTS); $optOutGroupsNames = Hash::combine($optOutGroups, '{n}.name', '{n}.displayExtension'); foreach ($memberOfGroups as &$memberOfGroup) { @@ -282,7 +282,7 @@ private function memberOfGroups(string $actorUserId, string $userId, array $cfg) $this->initApi($cfg); try { - return $this->grouperAPI->getUserGroupMemberships($actorUserId, $userId); + return $this->grouperAPI->getUserGroups($actorUserId, $userId); } catch (Exception $e) { CakeLog::write('error', __METHOD__ . ': An error occurred'); throw $e; @@ -308,8 +308,8 @@ public function getOwnedGroups(string $userId, array $cfg): array $this->initApi($cfg); try { - $resultsAdmin = $this->grouperAPI->getGrouperUserMemberships($userId, $userId, GrouperGroupTypeEnum::ADMIN); - $resultsUpdate = $this->grouperAPI->getGrouperUserMemberships($userId, $userId, GrouperGroupTypeEnum::UPDATE); + $resultsAdmin = $this->grouperAPI->getUserMemberships($userId, $userId, GrouperGroupTypeEnum::ADMIN); + $resultsUpdate = $this->grouperAPI->getUserMemberships($userId, $userId, GrouperGroupTypeEnum::UPDATE); } catch (Exception $e) { CakeLog::write('error', __METHOD__ . ': An error occurred'); throw $e; @@ -331,7 +331,7 @@ public function getOwnedGroups(string $userId, array $cfg): array public function getOwnedStems(string $userId): array { try { - return $this->grouperAPI->getGrouperUserMemberships($userId, $userId, GrouperGroupTypeEnum::ADMIN); + return $this->grouperAPI->getUserMemberships($userId, $userId, GrouperGroupTypeEnum::ADMIN); } catch (Exception $e) { CakeLog::write('error', __METHOD__ . ': An error occurred'); throw $e; @@ -439,9 +439,9 @@ public function optinGroups(string $userId, array $cfg): array try { // Groups the user can join or leave - $joinOrLeave = $this->grouperAPI->getGrouperUserMemberships($userId, - $userId, - GrouperGroupTypeEnum::OPTINS); + $joinOrLeave = $this->grouperAPI->getUserMemberships($userId, + $userId, + GrouperGroupTypeEnum::OPTINS); } catch (Exception $e) { CakeLog::write('error', __METHOD__ . ': An error occurred'); throw $e; @@ -449,7 +449,7 @@ public function optinGroups(string $userId, array $cfg): array try { // Groups the user is a member of - $userGroups = $this->grouperAPI->getUserGroupMemberships($userId, $userId); + $userGroups = $this->grouperAPI->getUserGroups($userId, $userId); } catch (Exception $e) { CakeLog::write('error', __METHOD__ . ': An error occurred'); throw $e;