Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #13 from Ioannis/Remove_obsolete_code
Remove obsolete code
aaschenbrener committed Mar 1, 2024
2 parents 79e7904 + 73cb251 commit 27396bf
Showing 33 changed files with 17 additions and 2,557 deletions.
11 changes: 0 additions & 11 deletions 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));
}

8 changes: 6 additions & 2 deletions 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,
22 changes: 11 additions & 11 deletions 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,17 +439,17 @@ 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;
}

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;
75 changes: 0 additions & 75 deletions PlantUML/1.puml

This file was deleted.

25 changes: 0 additions & 25 deletions PlantUML/2.puml

This file was deleted.

46 changes: 0 additions & 46 deletions PlantUML/3.puml

This file was deleted.

64 changes: 0 additions & 64 deletions PlantUML/4.puml

This file was deleted.

0 comments on commit 27396bf

Please sign in to comment.