Skip to content

Commit

Permalink
Log to file group and permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaIvanovski committed Feb 13, 2024
1 parent 16f5e5e commit 71bc056
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Service/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ public function isAllowed(string $right, $subject = null): bool
$userId = $this->tokenService->getTokenClaim(Token::CLAIM_USERID);
$groups = $this->legacyService->getUserGroupIds($userId);


file_put_contents(__DIR__ . '/../../tests-authorization.txt', '-----------------' . PHP_EOL, FILE_APPEND | LOCK_EX);
file_put_contents(__DIR__ . '/../../tests-authorization.txt', ' userId: '. $userId . PHP_EOL, FILE_APPEND | LOCK_EX);
file_put_contents(__DIR__ . '/../../tests-authorization.txt', ' groups: '. serialize($groups) . PHP_EOL, FILE_APPEND | LOCK_EX);
file_put_contents(__DIR__ . '/../../tests-authorization.txt', ' permissions: '. serialize($this->permissions) . PHP_EOL, FILE_APPEND | LOCK_EX);


$isAllowed = false;

foreach ($groups as $id) {
Expand Down
4 changes: 4 additions & 0 deletions src/Service/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ public function createToken(?string $username = null, ?string $password = null):
$config->signingKey()
);

file_put_contents(__DIR__ . '/../../tests-token.txt', '-----------------' . PHP_EOL, FILE_APPEND | LOCK_EX);
file_put_contents(__DIR__ . '/../../tests-token.txt', 'userId: ' . $user->id()->val() . PHP_EOL, FILE_APPEND | LOCK_EX);
file_put_contents(__DIR__ . '/../../tests-token.txt', 'token: ' . $token->toString() . PHP_EOL, FILE_APPEND | LOCK_EX);

$this->registerToken($user, $token, $time, $expire);

return $token;
Expand Down

0 comments on commit 71bc056

Please sign in to comment.