Skip to content

Fall back to the basic role when somebody holds no office - #2001

Merged
vikrantwiz02 merged 1 commit into
FusionIIIT:prod/acad-reactfrom
vikrantwiz02:fix-acting-role-basic-fallback
Sep 30, 2026
Merged

vikrantwiz02 merged 1 commit into
FusionIIIT:prod/acad-reactfrom
vikrantwiz02:fix-acting-role-basic-fallback

Conversation

@vikrantwiz02

Copy link
Copy Markdown
Member

Follow-up to #2000, which moved authorisation from "every role held" to "the role being acted in". The fallback it used when nobody has chosen a role was wrong.

What broke

active_designation returned the first office held. A basic role — student, faculty, staff — is not an office, so anyone holding only one of those resolved to no role at all and was refused by every one of the 175 @role_required endpoints.

An account that also holds an office resolved fine, which is why it got past testing and showed up as a student seeing Error: Request failed with status code 403 on their own Registered Courses page.

The fix

The fallback now tries offices first and then the basic role, so a plain student acts as student. A role that is no longer held falls back the same way instead of to nothing.

Tests

The two cases that were missing:

  • somebody holding only the basic role still acts in it
  • somebody holding nothing at all acts in nothing

One existing assertion corrected: it expected None after an office was revoked, where falling back to the student the user still holds is the right answer.

52 tests pass in the affected apps.

active_designation returned the first office held, and a basic role is not an
office — so anyone holding only student, faculty or staff resolved to no role
at all and was refused by every one of the 175 role_required endpoints. An
account that also holds an office looked fine, which is why it reached
production before it was caught.

A role that is no longer held now falls back the same way rather than to
nothing, and the two cases that were missing are tested: somebody holding only
the basic role, and somebody holding nothing at all.
@vikrantwiz02
vikrantwiz02 merged commit 197705a into FusionIIIT:prod/acad-react Sep 30, 2026
1 check passed
@vikrantwiz02
vikrantwiz02 deleted the fix-acting-role-basic-fallback branch October 2, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant