Continuation of #677 (ArtStudioController auth consolidation). ThreeDModelController repeats the identical token-user-id auth check in all 4 endpoints (var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; if empty return Unauthorized('User ID not found in token')) — SonarQube S1192 flagged the message duplicated 4x.
Fix: extract a private TryGetUserId(out userId, out ActionResult? error) helper (same pattern as #376) and replace all 4 blocks. Behavior identical; all 18 ThreeDModelController tests pass; build clean.
Note: the auth pattern is codebase-wide (~11 controllers). ArtStudioPresetsController (4x) uses a UserId() helper variant and Position/Profile/etc use assorted messages — a shared ControllerBase extension could unify them all, deferred to avoid churn/conflicts while the team is moving fast. SonarQube rule csharpsquid:S1192.
Continuation of #677 (ArtStudioController auth consolidation). ThreeDModelController repeats the identical token-user-id auth check in all 4 endpoints (var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; if empty return Unauthorized('User ID not found in token')) — SonarQube S1192 flagged the message duplicated 4x.
Fix: extract a private TryGetUserId(out userId, out ActionResult? error) helper (same pattern as #376) and replace all 4 blocks. Behavior identical; all 18 ThreeDModelController tests pass; build clean.
Note: the auth pattern is codebase-wide (~11 controllers). ArtStudioPresetsController (4x) uses a UserId() helper variant and Position/Profile/etc use assorted messages — a shared ControllerBase extension could unify them all, deferred to avoid churn/conflicts while the team is moving fast. SonarQube rule csharpsquid:S1192.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Continuation of #677 (ArtStudioController auth consolidation). ThreeDModelController repeats the identical token-user-id auth check in all 4 endpoints (var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; if empty return Unauthorized('User ID not found in token')) — SonarQube S1192 flagged the message duplicated 4x.
Fix: extract a private TryGetUserId(out userId, out ActionResult? error) helper (same pattern as #376) and replace all 4 blocks. Behavior identical; all 18 ThreeDModelController tests pass; build clean.
Note: the auth pattern is codebase-wide (~11 controllers). ArtStudioPresetsController (4x) uses a UserId() helper variant and Position/Profile/etc use assorted messages — a shared ControllerBase extension could unify them all, deferred to avoid churn/conflicts while the team is moving fast. SonarQube rule csharpsquid:S1192.
Verified complete: backend PR #378 merged; ThreeDModelController now uses TryGetUserId (5 call sites) with the duplicated checks consolidated. Closing.