Skip to content

Commit

Permalink
Minor: Format code - refs BT#21930
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Sep 13, 2024
1 parent 274f9f2 commit 2b5eeb5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 42 deletions.
76 changes: 38 additions & 38 deletions plugin/azure_active_directory/src/AzureActiveDirectory.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,44 @@ public function registerUser(
return $userId;
}

/**
* @return array<string, string|false>
*/
public function getGroupUidByRole(): array
{
$groupUidList = [
'admin' => $this->get(self::SETTING_GROUP_ID_ADMIN),
'sessionAdmin' => $this->get(self::SETTING_GROUP_ID_SESSION_ADMIN),
'teacher' => $this->get(self::SETTING_GROUP_ID_TEACHER),
];

return array_filter($groupUidList);
}

/**
* @return array<string, callable>
*/
public function getUpdateActionByRole(): array
{
return [
'admin' => function (User $user) {
$user->setStatus(COURSEMANAGER);

UserManager::addUserAsAdmin($user, false);
},
'sessionAdmin' => function (User $user) {
$user->setStatus(SESSIONADMIN);

UserManager::removeUserAdmin($user, false);
},
'teacher' => function (User $user) {
$user->setStatus(COURSEMANAGER);

UserManager::removeUserAdmin($user, false);
},
];
}

/**
* @throws Exception
*/
Expand Down Expand Up @@ -347,42 +385,4 @@ private function formatUserData(
$extra,
];
}

/**
* @return array<string, string|false>
*/
public function getGroupUidByRole(): array
{
$groupUidList = [
'admin' => $this->get(self::SETTING_GROUP_ID_ADMIN),
'sessionAdmin' => $this->get(self::SETTING_GROUP_ID_SESSION_ADMIN),
'teacher' => $this->get(self::SETTING_GROUP_ID_TEACHER),
];

return array_filter($groupUidList);
}

/**
* @return array<string, callable>
*/
public function getUpdateActionByRole(): array
{
return [
'admin' => function (User $user) {
$user->setStatus(COURSEMANAGER);

UserManager::addUserAsAdmin($user, false);
},
'sessionAdmin' => function (User $user) {
$user->setStatus(SESSIONADMIN);

UserManager::removeUserAdmin($user, false);
},
'teacher' => function (User $user) {
$user->setStatus(COURSEMANAGER);

UserManager::removeUserAdmin($user, false);
},
];
}
}
4 changes: 2 additions & 2 deletions plugin/azure_active_directory/src/AzureCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ protected function getAzureGroups(): Generator
}

/**
* @return Generator<int, array<string, string>>
*
* @throws Exception
*
* @return Generator<int, array<string, string>>
*/
protected function getAzureGroupMembers(string $groupUid): Generator
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

/* For license terms, see /license.txt */

use League\OAuth2\Client\Token\AccessTokenInterface;

class AzureSyncUsergroupsCommand extends AzureCommand
{
/**
Expand Down

0 comments on commit 2b5eeb5

Please sign in to comment.