Skip to content

Conversation

@MatteoGuarnaccia5
Copy link
Contributor

@MatteoGuarnaccia5 MatteoGuarnaccia5 commented Nov 17, 2025

Description

see #1593

A few cases have been investigated for what happens when a user's token contains a privileged role, but the user in the user_config.yaml no longer.

  1. User clicks somewhere triggering refresh, their token is now updated with their correct role and authProvider's state recomputes if they are a privileged user
  2. User clicks on admin dialog e.g. edit as admin, which triggers refresh of token. The user is able to navigate the dialog but there will be an error stating they are unauthorised / cannot bypass rules so the request is blocked by the backend.
  3. User is on admin dialog, then there is a change in the config. The user will be able to submit the dialog as if they were admin as dialog navigation does not trigger a refresh
  4. User is on admin dialog, IMS auto refreshes the token (this happens after ~10min), same as case 2 there will be an error following dialog submission

Testing instructions

  • Review code
  • Check Actions build
  • Review changes to test coverage

Agile board tracking

closes #1593

@MatteoGuarnaccia5 MatteoGuarnaccia5 changed the base branch from develop to implement-authorisation-rules-#1523 November 17, 2025 16:06
@codecov
Copy link

codecov bot commented Nov 17, 2025

❌ 8 Tests Failed:

Tests completed Failed Passed Skipped
839 8 831 1
View the top 3 failed test(s) by shortest run time
src/items/itemDialog.component.test.tsx > ItemDialog > Edit Item > displays warning when in admin mode for edit
Stack Traces | 1.77s run time
Error: Snapshot `ItemDialog > Edit Item > displays warning when in admin mode for edit 1` mismatched

- Expected
+ Received

@@ -22,19 +22,19 @@
        role="presentation"
        style="opacity: 1; webkit-transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;"
        tabindex="-1"
      >
        <div
-         aria-labelledby=":r3js:"
+         aria-labelledby=":r3cp:"
          aria-modal="true"
          class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation24 MuiDialog-paper MuiDialog-paperScrollPaper MuiDialog-paperWidthXl MuiDialog-paperFullWidth css-ji9sn5-MuiPaper-root-MuiDialog-paper"
          role="dialog"
          style="--Paper-shadow: 0px 11px 15px -7px rgba(0,0,0,0.2),0px 24px 38px 3px rgba(0,0,0,0.14),0px 9px 46px 8px rgba(0,0,0,0.12);"
        >
          <h2
            class="MuiTypography-root MuiTypography-h6 MuiDialogTitle-root css-19csis5-MuiTypography-root-MuiDialogTitle-root"
-           id=":r3js:"
+           id=":r3cp:"
          >
            Edit Item as Admin
            <svg
              aria-hidden="true"
              aria-label="As an admin, you can bypass rules that restrict item placement for other users, and you can modify the item's usage status"
@@ -519,16 +519,16 @@
                                            </svg>
                                          </button>
                                        </span>
                                      </div>
                                      <input
-                                       aria-describedby=":r3k7:-helper-text"
+                                       aria-describedby=":r3d4:-helper-text"
                                        aria-invalid="false"
                                        aria-label="Filter by Name"
                                        autocomplete="off"
                                        class="MuiInputBase-input MuiInput-input MuiInputBase-inputAdornedStart MuiInputBase-inputAdornedEnd css-110vr2a-MuiInputBase-input-MuiInput-input"
-                                       id=":r3k7:"
+                                       id=":r3d4:"
                                        placeholder="Filter by Name"
                                        title="Filter by Name"
                                        type="text"
                                        value=""
                                      />
@@ -562,11 +562,11 @@
                                        </span>
                                      </div>
                                    </div>
                                    <p
                                      class="MuiFormHelperText-root MuiFormHelperText-sizeMedium css-v98l45-MuiFormHelperText-root"
-                                     id=":r3k7:-helper-text"
+                                     id=":r3d4:-helper-text"
                                    >
                                      <label>
                                        Filter Mode: Fuzzy
                                      </label>
                                    </p>
@@ -707,17 +707,17 @@
                                            </svg>
                                          </button>
                                        </span>
                                      </div>
                                      <div
-                                       aria-describedby=":r3kg:-helper-text"
+                                       aria-describedby=":r3dd:-helper-text"
                                        aria-expanded="false"
                                        aria-haspopup="listbox"
                                        aria-label="Filter by Type"
-                                       aria-labelledby=":r3kg:"
+                                       aria-labelledby=":r3dd:"
                                        class="MuiSelect-select MuiSelect-standard MuiSelect-multiple MuiInputBase-input MuiInput-input MuiInputBase-inputAdornedStart MuiInputBase-inputAdornedEnd css-10y8whu-MuiSelect-select-MuiInputBase-input-MuiInput-input"
-                                       id=":r3kg:"
+                                       id=":r3dd:"
                                        role="combobox"
                                        tabindex="0"
                                      >
                                        <div
                                          class="MuiBox-root css-1tzeee1"
@@ -775,11 +775,11 @@
                                        </span>
                                      </div>
                                    </div>
                                    <p
                                      class="MuiFormHelperText-root MuiFormHelperText-sizeMedium css-v98l45-MuiFormHelperText-root"
-                                     id=":r3kg:-helper-text"
+                                     id=":r3dd:-helper-text"
                                    >
                                      <label>
                                        Filter Mode: Includes any
                                      </label>
                                    </p>
@@ -882,15 +882,15 @@
                                    >
                                      <div
                                        class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-adornedEnd css-6h9cc6-MuiInputBase-root-MuiInput-root"
                                      >
                                        <input
-                                         aria-describedby=":r3kp:-helper-text"
+                                         aria-describedby=":r3dm:-helper-text"
                                          aria-invalid="false"
                                          autocomplete="off"
                                          class="MuiInputBase-input MuiInput-input MuiInputBase-inputAdornedEnd css-1yrc8ca-MuiInputBase-input-MuiInput-input"
-                                         id=":r3kp:"
+                                         id=":r3dm:"
                                          inputmode="text"
                                          placeholder="Min"
                                          type="text"
                                          value=""
                                        />
@@ -917,11 +917,11 @@
                                          </button>
                                        </div>
                                      </div>
                                      <p
                                        class="MuiFormHelperText-root MuiFormHelperText-sizeMedium css-18y2hez-MuiFormHelperText-root"
-                                       id=":r3kp:-helper-text"
+                                       id=":r3dm:-helper-text"
                                      >
                                        <label>
                                          Filter Mode: Between Inclusive
                                        </label>
                                      </p>
@@ -934,11 +934,11 @@
                                      >
                                        <input
                                          aria-invalid="false"
                                          autocomplete="off"
                                          class="MuiInputBase-input MuiInput-input MuiInputBase-inputAdornedEnd css-1yrc8ca-MuiInputBase-input-MuiInput-input"
-                                         id=":r3ks:"
+                                         id=":r3dp:"
                                          inputmode="text"
                                          placeholder="Max"
                                          type="text"
                                          value=""
                                        />
@@ -1006,11 +1006,11 @@
                          <div
                            class="MuiBox-root css-exd1zr"
                          >
                            <label
                              class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-animated MuiFormLabel-colorPrimary MuiInputLabel-root MuiInputLabel-animated css-10j3yc8-MuiFormLabel-root-MuiInputLabel-root"
-                             for="mrt-rows-per-page-:r3k0:"
+                             for="mrt-rows-per-page-:r3ct:"
                            >
                              Rows per page
                            </label>
                            <div
                              class="MuiInputBase-root MuiInput-root MuiInputBase-colorPrimary MuiSelect-root css-1y2ya84-MuiInputBase-root-MuiInput-root-MuiSelect-root"
@@ -1027,11 +1027,11 @@
                              </div>
                              <input
                                aria-hidden="true"
                                aria-invalid="false"
                                class="MuiSelect-nativeInput css-j0riat-MuiSelect-nativeInput"
-                               id="mrt-rows-per-page-:r3k0:"
+                               id="mrt-rows-per-page-:r3ct:"
                                tabindex="-1"
                                value="5"
                              />
                              <svg
                                aria-hidden="true"
@@ -1141,11 +1141,11 @@
    <div
      class="MuiPopper-root MuiTooltip-popper MuiTooltip-popperInteractive MuiTooltip-popperArrow css-s8pgp9-MuiPopper-root-MuiTooltip-popper"
      data-popper-escaped=""
      data-popper-placement="top"
      data-popper-reference-hidden=""
-     id=":r3jt:"
+     id=":r3cq:"
      role="tooltip"
      style="position: absolute; top: auto; left: 0px; margin: 0px; right: auto; bottom: 0px; transform: translate(0px, 0px);"
    >
      <div
        class="MuiTooltip-tooltip MuiTooltip-tooltipArrow MuiTooltip-tooltipPlacementTop css-1eex93v-MuiTooltip-tooltip"

 ❯ src/items/itemDialog.component.test.tsx:1257:27
src/items/itemDialog.component.test.tsx > ItemDialog > Edit Item > disables finish button and shows circular progress indicator when request is pending
Stack Traces | 5.04s run time
Error: Test timed out in 5000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ src/items/itemDialog.component.test.tsx:1260:5
src/items/itemDialog.component.test.tsx > ItemDialog > Add Item > disables finish button and shows circular progress indicator when request is pending
Stack Traces | 5.16s run time
Error: Test timed out in 5000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ src/items/itemDialog.component.test.tsx:166:5
src/items/itemDialog.component.test.tsx > ItemDialog > Add Item > adds an item (case empty string with spaces returns null and change property boolean values)
Stack Traces | 10.2s run time
Error: Test timed out in 10000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ src/items/itemDialog.component.test.tsx:696:5
src/items/itemDialog.component.test.tsx > ItemDialog > Add Item > adds an item (all input values)
Stack Traces | 10.3s run time
Error: Test timed out in 10000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ src/items/itemDialog.component.test.tsx:473:5
src/catalogue/category/catalogueCategoryDialog.component.test.tsx > Catalogue Category Dialog > Add Catalogue Category Dialog > create a catalogue category with content being catalogue items (allowed_values list of strings)
Stack Traces | 20.1s run time
Error: Test timed out in 20000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ .../catalogue/category/catalogueCategoryDialog.component.test.tsx:749:5
src/systems/systemItemsTable.component.test.tsx > SystemItemsTable > can open the duplicate dialog and checks that the notes have been updated with no serial number
Stack Traces | 21s run time
Error: Test timed out in 20000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ src/systems/systemItemsTable.component.test.tsx:455:3
View the full list of 1 ❄️ flaky test(s)
src/catalogue/category/catalogueCategoryDialog.component.test.tsx > Catalogue Category Dialog > Add Catalogue Category Dialog > create a catalogue category with content being catalogue items (allowed_values list of strings) that includes extra spaces in the allowed values

Flake rate in main: 7.14% (Passed 39 times, Failed 3 times)

Stack Traces | 1.43s run time
Error: expect(element).toBeInTheDocument()

element could not be found in the document
 ❯ modifyValues .../catalogue/category/catalogueCategoryDialog.component.test.tsx:62:9
 ❯ .../catalogue/category/catalogueCategoryDialog.component.test.tsx:801:7

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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.

User role not updating in token on refresh

2 participants