Commit 0a8918fa authored by Jacob Priddy's avatar Jacob Priddy 👌
Browse files

Merge branch '67-fix-api-authorizer-caching' into 'master'

Resolve "Fix Api Authorizer Caching"

Closes #67

See merge request !55
parents 89f8fbed b5bd35c8
Pipeline #9252 passed with stages
in 2 minutes and 53 seconds
docker-compose.yml
.vscode
/src/profile
......@@ -35,7 +35,7 @@ class ApiAuthorizer implements Authorizer
/**
* @var string[]
*/
protected array $userGroups = [];
protected ?array $userGroups = null;
public function __construct(
?string $currentUserId,
......@@ -55,7 +55,7 @@ class ApiAuthorizer implements Authorizer
public function setCurrentUserId(?string $id): void
{
if ($this->currentUserId !== $id) {
$this->userGroups = [];
$this->userGroups = null;
$this->currentUserId = $id;
}
}
......@@ -123,7 +123,7 @@ class ApiAuthorizer implements Authorizer
protected function getGroupsForUser(string $userId): array
{
if ($userId === $this->currentUserId) {
if (!$this->userGroups) {
if ($this->userGroups === null) {
$this->userGroups = static::groupNames($this->groupUserRepository->getGroupsForUser($userId));
}
......
......@@ -23,7 +23,7 @@ class LocalSchedulesRepository extends InMemorySchedulesRepository
));
$this->create(new Schedule(
1,
2,
LocalGroupsRepository::getComputerScienceMajorGroup()->getId(),
Schedule::TYPE_OPEN_MODE,
// Open mode for 10 mintes, not open mode for 10 minutes
......
......@@ -60,7 +60,8 @@ class GetAllUsersApiTest extends AuthenticatesWithApplicationTestCase
/**
* @test
* @throws EntityNotFoundException
* @throws \Source\Exceptions\EntityExistsException
* @throws \Source\Exceptions\EntityNotFoundException
*/
public function it_returns_users_in_the_repository(): void
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment