Skip to content

fix: refactor institution handling in user authorization and mutation - #1289

Merged
jekabs-karklins merged 32 commits into
developfrom
SWAP-5157-update-upsertuserbyoidcsub
Mar 11, 2026
Merged

fix: refactor institution handling in user authorization and mutation#1289
jekabs-karklins merged 32 commits into
developfrom
SWAP-5157-update-upsertuserbyoidcsub

Conversation

@jekabs-karklins

@jekabs-karklins jekabs-karklins commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

Description

This PR refactors the way institution is defined when calling upserUserByOidc

Motivation and Context

This change allows to call upserUserByOidc and specify institution in two ways
Either specifying

RorId
or
{institutionName: string, institutionCountry: string}

Changes

  1. Refactored getOrCreateUserInstitution method in OAuthAuthorization to accept different types of input (ROR ID, manual input, institution ID), and split into smaller, more specific methods.
  2. Updated getOrCreateUserInstitution method in StfcUserAuthorization to match the new input type.
  3. Updated getOrCreateUserInstitution method in UserAuthorization to match the new input type.

How Has This Been Tested

Unit tests have been added and updated and run to ensure the changes work as expected. Additionally, manual testing has been performed to verify correct functionality in a live environment.

Fixes Jira Issue

https://jira.esss.lu.se/browse/SWAP-5157

@jekabs-karklins
jekabs-karklins requested a review from a team as a code owner December 10, 2025 10:46
@jekabs-karklins
jekabs-karklins requested review from Scott-James-Hurley and removed request for a team December 10, 2025 10:46
@jekabs-karklins
jekabs-karklins marked this pull request as draft December 10, 2025 12:24
@jekabs-karklins jekabs-karklins changed the title feat: refactor institution handling in user authorization and mutations [WIP] feat: refactor institution handling in user authorization and mutations Dec 10, 2025
@jekabs-karklins jekabs-karklins changed the title [WIP] feat: refactor institution handling in user authorization and mutations fix: refactor institution handling in user authorization and mutations [WIP] Dec 17, 2025
@jekabs-karklins jekabs-karklins changed the title fix: refactor institution handling in user authorization and mutations [WIP] fix: refactor institution handling in user authorization and mutation Feb 24, 2026
Comment thread apps/backend/src/auth/OAuthAuthorization.spec.ts
@jekabs-karklins
jekabs-karklins marked this pull request as ready for review February 24, 2026 18:17
@UserOfficeProject UserOfficeProject deleted a comment from Copilot AI Mar 2, 2026
@jekabs-karklins

Copy link
Copy Markdown
Contributor Author

Hi, @Scott-James-Hurley
Could you please check this at your earliest convenience. This is currently a blocker for us, and would be nice to get it merged

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated 6 comments.

Comment thread apps/e2e/cypress/support/user.ts
Comment thread apps/backend/src/mutations/UserMutations.spec.ts
Comment thread apps/backend/src/mutations/UserMutations.spec.ts Outdated
Comment thread apps/backend/src/mutations/UserMutations.spec.ts
Comment thread validation/src/User/index.ts
Comment thread apps/backend/src/auth/mockups/UserAuthorization.ts
@jekabs-karklins

Copy link
Copy Markdown
Contributor Author

@yoganandaness I have addressed the comments, since we are blocking the IAM team this would be nice to get merged so we can ublock them

@Scott-James-Hurley Scott-James-Hurley left a comment

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.

Looks great

yoga-teachedison

This comment was marked as outdated.

@yoganandaness
yoganandaness requested review from yoga-teachedison and removed request for yoga-teachedison March 11, 2026 17:03

@yoganandaness yoganandaness left a comment

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.

  1. Adding ROR_API_URL to env.example is good for documentation purpose.
  2. Copilot Comments on Empty RoR ID handling was interesting
  3. Also adding a brief about this in Documentation will be great(if applicable).

Otherwise looks good. Approving this.

@yoganandaness
yoganandaness requested review from yoga-teachedison and removed request for yoga-teachedison March 11, 2026 17:05
@jekabs-karklins
jekabs-karklins merged commit 1712b1f into develop Mar 11, 2026
22 checks passed
@jekabs-karklins
jekabs-karklins deleted the SWAP-5157-update-upsertuserbyoidcsub branch March 11, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants