Skip to content
Draft
Show file tree
Hide file tree
Changes from 102 commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
d94e914
implement v2 user, wip
bikubi May 27, 2026
7e6e92b
chore: Nikola's comments
nikola-maric-aula May 27, 2026
96f4d5f
wip
bikubi May 28, 2026
94594d7
try domain model
bikubi Jun 1, 2026
cf71d1c
more wip
bikubi Jun 1, 2026
02a4b3e
more cleanup, refactor UserStatus everywhere
bikubi Jun 2, 2026
9fa5681
Merge branch 'main' into v2-user
bikubi Jun 2, 2026
41560ee
implement "input dto"s via rule inheritance
bikubi Jun 9, 2026
1478fc5
use constructors in UseCases
bikubi Jun 9, 2026
ce59890
avoid empty LegacyUser
bikubi Jun 9, 2026
f862a22
cleanup
bikubi Jun 9, 2026
8a0cdb4
use hash_id over id
bikubi Jun 9, 2026
ea58793
readonly UserData
bikubi Jun 9, 2026
e5761bb
pluralize endpoint
bikubi Jun 9, 2026
055466a
fix readonly UserData
bikubi Jun 9, 2026
ad2c191
disallow PATCH
bikubi Jun 9, 2026
17a336a
output created
bikubi Jun 9, 2026
dd06f82
missing uses
bikubi Jun 10, 2026
22e9a27
require laravel-data
bikubi Jun 10, 2026
6610fe4
implement Optional properties abstractly
bikubi Jun 10, 2026
4bca298
fix-suppress psalm errors
bikubi Jun 11, 2026
36e168a
strictify + cleanup
bikubi Jun 11, 2026
e656bc0
prohibit update/store of created
bikubi Jun 12, 2026
d55c55a
test (hash)id properly
bikubi Jun 12, 2026
995057a
restructure crud test
bikubi Jun 15, 2026
22d4263
improve tests
bikubi Jun 15, 2026
aacaed3
"prohibit" other props in request
bikubi Jun 15, 2026
e8a41b0
add todo
bikubi Jun 15, 2026
c19cb96
Merge branch 'main' into v2-user-abstract
bikubi Jun 15, 2026
1b9869e
output last_update/updatedAt
bikubi Jun 15, 2026
21605bf
docs
bikubi Jun 15, 2026
5a2a187
remove attempt without laravel-data, using vanilla Resource + Requests
bikubi Jun 15, 2026
75e60c4
get rid of Optional, use nullable
bikubi Jun 16, 2026
f9205eb
fix controller dependency injection
bikubi Jun 16, 2026
6c91324
validate route param user/uuid
bikubi Jun 16, 2026
c4db598
fix: user public ids are not uuids
bikubi Jun 16, 2026
3be92db
fix patch disallowed test
bikubi Jun 16, 2026
62a5c3a
normalize names of created&updatedAt
bikubi Jun 16, 2026
acc1158
remove id from user data objects
bikubi Jun 16, 2026
4cdf06e
rename hashId to publicId
bikubi Jun 16, 2026
18b2aa1
404 if instancecode/tenant header not set
bikubi Jun 18, 2026
bbfd72b
ref: renaming classes and inner cosmetics
nikola-maric-aula Jun 18, 2026
c736623
chore: update .env.testing for various setups
nikola-maric-aula Jun 18, 2026
1de7f25
chore: some merge/rebase fixups
nikola-maric-aula Jun 18, 2026
f144df8
feat: use hash_id from the jwt in LegacyJwtMiddleware
nikola-maric-aula Jul 1, 2026
8baeb56
docs: controllers in our clean code setup
nikola-maric-aula Jul 1, 2026
a2adf48
Merge branch 'main' of github.com:aula-app/aula-backend into v2-user-…
nikola-maric-aula Jul 1, 2026
b913579
fix .env.testing for local (vscode) setup
bikubi Jul 6, 2026
d0024f5
fix legacy auth test
bikubi Jul 6, 2026
4912fe1
fix sso test WIP
bikubi Jul 6, 2026
7b55f77
fix removed column
bikubi Jul 6, 2026
0fb1973
fix more id->hash usage
bikubi Jul 6, 2026
a3ea923
implement authn+authz for /api/v2/users via legacy/jwt middleware
bikubi Jul 6, 2026
9145188
use LegacyJwtGuard for simple authz
bikubi Jul 7, 2026
da78340
implement gate-based authz
bikubi Jul 8, 2026
0dd1b6d
move gates to provider
bikubi Jul 13, 2026
b648e7c
try policy wip/stub
bikubi Jul 13, 2026
091641b
cleanup
bikubi Jul 13, 2026
6e48cb8
fix legacy user data handling
bikubi Jul 14, 2026
cb55eec
provide app version via config, appease psalm
bikubi Jul 15, 2026
6a244ea
fix: reject JWTs with an empty user_hash claim
aivuk Jul 27, 2026
28474ec
refactor: make ListUsersUseCase::execute an instance method
aivuk Jul 27, 2026
0954c88
refactor: authorize in use cases, not controllers
aivuk Jul 27, 2026
5ba0fbc
docs: record the authorization placement decision
aivuk Jul 27, 2026
5ac5329
fix: make au_users_basedata.hash_id unique and indexed
aivuk Jul 27, 2026
80dc39f
fix: don't assume every gated user is a LegacyUser
aivuk Jul 27, 2026
6d70e76
refactor: single source of truth for the admin predicate
aivuk Jul 27, 2026
4bd0fee
fix: block userlevel/status escalation on non-admin self-update
aivuk Jul 27, 2026
9ae1464
test: cover privileged-field enforcement on user update
aivuk Jul 27, 2026
18ae601
Merge branch 'fix/v2-jwt-hash-id-lookup' into v2-user-abstract-nikola
bikubi Jul 28, 2026
93de0bd
Merge branch 'fix/v2-gate-before-type-guard' into v2-user-abstract-ni…
bikubi Jul 28, 2026
2115778
Merge branch 'fix/v2-user-self-update-escalation' into v2-user-abstra…
bikubi Jul 28, 2026
754590a
Merge branch 'refactor/v2-authz-in-usecase' into v2-user-abstract-nikola
bikubi Jul 28, 2026
2d7c889
refactor gate names as enum
bikubi Aug 3, 2026
5243261
api params follow new models' camelCase, not legacy column_names
bikubi Aug 3, 2026
0dc95b9
Merge branch 'main' into v2-user-abstract-nikola
bikubi Aug 3, 2026
13826ef
fix user status comparison
bikubi Aug 5, 2026
59bc244
cleanup
bikubi Aug 5, 2026
a849aaa
improve tests
bikubi Aug 5, 2026
b2f27a5
readability
bikubi Aug 5, 2026
90f0117
feat: Passport auth using Central:Client and Tenant:LegacyUser
nikola-maric-aula Aug 6, 2026
a2d64a2
fix(entrypoint.sh): ensure ./storage ownership (always)
nikola-maric-aula Aug 6, 2026
7d3696c
fix(docker): ignore unrelated folders for the root project
nikola-maric-aula Aug 6, 2026
d0e4c11
feat: add custom JWT claims to OAuth2 Access Token
nikola-maric-aula Aug 6, 2026
8422cb7
feat: legacy can verify assymetric key used inv2 JWT
nikola-maric-aula Aug 6, 2026
d75d24d
chore: docs and cleanup
nikola-maric-aula Aug 10, 2026
7467a06
chore: remove unused tenant db seeder code
nikola-maric-aula Aug 10, 2026
c21eb1c
feat: repurpose LegacyLoginController in v2 authN
nikola-maric-aula Aug 11, 2026
7d90b4d
Merge branch 'main' into feat/v2-auth-passport-cross-tenant
nikola-maric-aula Aug 12, 2026
eaaa18d
fix: unit tests
nikola-maric-aula Aug 12, 2026
c38192f
feat(tenancy): db user includes tenant id in its name
nikola-maric-aula Aug 12, 2026
13b11d1
fix(test): create tenant command test
nikola-maric-aula Aug 12, 2026
0c95578
fix(test): sso user insert to standard room
nikola-maric-aula Aug 12, 2026
ff38dec
fix: database seeder for tenants (hint: use --env=testing)
nikola-maric-aula Aug 12, 2026
bc2926b
feat: LegacyAuthTest -> OAuth/TokenCreateTest
nikola-maric-aula Aug 13, 2026
9ba3d36
fix: sso controller and cleanup unused legacy jwt
nikola-maric-aula Aug 13, 2026
fa5502f
fix: sso-aware access token controller (renamed from legacy contrl.)
nikola-maric-aula Aug 17, 2026
e6cd050
chore: remove dead code LegacyJwtGuard
nikola-maric-aula Aug 17, 2026
d44dcb9
chore: rename pest tests to PestTest.php
nikola-maric-aula Aug 17, 2026
fb8999b
fix: SsoAwareAccessTokenController returns OAuth2-compatible response
nikola-maric-aula Aug 17, 2026
2eab68e
chore: cleanup LegacyUser model
nikola-maric-aula Aug 17, 2026
6b85d22
chore: debug setup for debugging tests
nikola-maric-aula Aug 17, 2026
bb2bc07
fix: composer update ide helpers not automatically
nikola-maric-aula Aug 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ info.php
**/docker-local/
**/docker-compose.*

# other projects in the repo
legacy/
keycloak/

nginx-reverse-proxy.conf
Dockerfile*
docker-compose*
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ indent_size = 2

[Makefile]
indent_style = tab

[composer.lock]
indent_size = 4
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@ LOG_LEVEL=debug
LOG_STDOUT_FORMATTER='\\Monolog\\Formatter\\JsonFormatter' # on null, default formatter will be used
LOG_STDERR_FORMATTER='\\Monolog\\Formatter\\JsonFormatter' # on null, default formatter will be used

DB_CONNECTION=mariadb
DB_CONNECTION=mariadb_central
DB_HOST=mariadb
DB_PORT=3306
DB_DATABASE=aula_database
DB_USERNAME=aula_user
DB_PASSWORD=example

# v1 related
CENTRAL_DB_HOST=mariadb
CENTRAL_DB_PORT=3306
CENTRAL_DB_NAME=aula_database
CENTRAL_DB_USER=aula_user
CENTRAL_DB_PASS=example
# end of v1 related

SESSION_DRIVER=database
SESSION_LIFETIME=120
Expand Down
2 changes: 1 addition & 1 deletion .env.testing
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

APP_KEY=base64:eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHg=

DB_CONNECTION=mariadb
DB_CONNECTION=mariadb_central
DB_HOST=127.0.0.1
# necessary for manual/local/VSCode
# (using docker-compose.yml, not .test.yml)
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Homestead.json
Homestead.yaml
Thumbs.db

legacy/config/*.key
!config/*-example
**/base_config.php
**/instances_config.php
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ test:
xdebug-v2-docker-setup:
docker compose exec aula-backend.v2 true
docker compose exec aula-backend.v2 sh -c 'apk add php84-pecl-xdebug; echo -e "zend_extension=/usr/lib/php84/modules/xdebug.so\nxdebug.mode=develop,debug\nxdebug.start_with_request=yes\nxdebug.client_host=host.docker.internal\nxdebug.client_port=9013\ndefault_socket_timeout=600" > /usr/local/etc/php/conf.d/docker-xdebug.ini'
docker compose exec aula-backend.v2 sh -c 'composer require --dev -m phpunit/phpunit ^12'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work for me ootb because post-update-cmd fails to write to .ide_helpers. I think IDE helpers within the container don't make much sense; maybe move it from implicit cmd to an explicit composer script to be run on demand (as well as depending on dev's IDE needs)?

docker compose restart aula-backend.v2
docker compose exec aula-backend.v2 php -i | grep xdebug.client_
@echo "Note: ephemeral, might need to rerun after docker compose restart/up/down!"
Expand Down
147 changes: 0 additions & 147 deletions app/Auth/LegacyJwtGuard.php

This file was deleted.

26 changes: 26 additions & 0 deletions app/Auth/PassportJwtClaims/AulaClaims.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Auth\PassportJwtClaims;

use App\Models\LegacyUser;
use CorBosman\Passport\AccessToken;

class AulaClaims
{
/**
* Process the generated JWT token, attach aula-specific data to it.
*
* @param mixed $next
*/
public function handle(AccessToken $token, $next)
{
$user = LegacyUser::find($token->getUserIdentifier());

$token->addClaim('user_hash', $user->hash_id);
$token->addClaim('temp_pw', !empty($user->temp_pw));
$token->addClaim('user_level', $user->userlevel?->value);
$token->addClaim('roles', json_decode($user->roles ?? '[]'));

return $next($token);
}
}
2 changes: 0 additions & 2 deletions app/Data/User/AbstractUserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

use DateTimeImmutable;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Attributes\MapName;
use Spatie\LaravelData\Attributes\Validation\Max;
use App\Enums\UserLevel;
use App\Enums\UserStatus;

Expand Down
2 changes: 0 additions & 2 deletions app/Data/User/DomainUserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
use DateTimeImmutable;
use App\Data\User\AbstractUserData;
use App\Enums\UserLevel;
use Spatie\LaravelData\Attributes\MapName;
use Spatie\LaravelData\Attributes\MapInputName;
use Spatie\LaravelData\Attributes\MapOutputName;

class DomainUserData extends AbstractUserData
{
Expand Down
114 changes: 0 additions & 114 deletions app/Http/Controllers/Auth/LegacyLoginController.php

This file was deleted.

7 changes: 1 addition & 6 deletions app/Http/Controllers/Auth/RefreshTokenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Models\LegacyUser;
use App\Services\LegacyJwtService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;

class RefreshTokenController extends Controller
{
public function __construct(
protected LegacyJwtService $jwtService
) {}

/**
* Refresh the JWT token.
* Matches the legacy refresh_token.php behavior.
Expand All @@ -22,7 +17,7 @@
{
// Extract token from Authorization header
$authHeader = $request->header('Authorization');
$token = $this->jwtService->extractBearerToken($authHeader);

Check failure on line 20 in app/Http/Controllers/Auth/RefreshTokenController.php

View workflow job for this annotation

GitHub Actions / scan_v2_psalm

UndefinedThisPropertyFetch

app/Http/Controllers/Auth/RefreshTokenController.php:20:18: UndefinedThisPropertyFetch: Instance property App\Http\Controllers\Auth\RefreshTokenController::$jwtService is not defined (see https://psalm.dev/041)

if ($token === null) {
return response()->json([
Expand Down Expand Up @@ -70,7 +65,7 @@
}

// Clear the refresh token flag
$user->clearRefreshToken();

Check failure on line 68 in app/Http/Controllers/Auth/RefreshTokenController.php

View workflow job for this annotation

GitHub Actions / scan_v2_psalm

UndefinedMagicMethod

app/Http/Controllers/Auth/RefreshTokenController.php:68:16: UndefinedMagicMethod: Magic method App\Models\LegacyUser::clearrefreshtoken does not exist (see https://psalm.dev/219)

// Generate new token with fresh user data
$newToken = $this->jwtService->generateToken($user);
Expand Down
Loading
Loading