Skip to content

ID-1174 Add combined user state api call to reduce needed ui api calls #1414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
May 23, 2024

Conversation

Ghost-in-a-Jar
Copy link
Contributor

@Ghost-in-a-Jar Ghost-in-a-Jar commented Apr 30, 2024

Ticket: https://broadworkbench.atlassian.net/browse/ID-1174

What:

Adds a combined user state api call in order to reduce the amount of api calls needed from the ui to sam in order to load user state.

Why:

Right now, Terra-UI makes 5 calls at once to Sam to get user information. This led to a recent incident where we added a call to Sam from Terra-UI on login, but forgot to tell Sam to ignore the ToS acceptance for that call.

In general, Terra-UI is very chatty with Terra APIs. This leads to an increased risk of call failure. This new endpoint will make the UI less error-prone in its communication with Sam, as well as simplify the login code in the UI.

How:

I added a new api endpoint that returns the user's samUser, allowances, attributes, terms of service details, and enterprise features.

These are all to replace the multiple api calls in the ui here with a single call.


PR checklist

  • I've followed the instructions if I've made any changes to the API, especially if they're breaking changes
  • I've filled out the Security Risk Assessment (requires Broad Internal network access) and attached the result to the JIRA ticket

Set.empty,
includePublic = false,
samRequestContext
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I matched this with the call that the ui is doing

@@ -27,6 +27,8 @@ class MockSamRoutesBuilder(allUsersGroup: WorkbenchGroup)(implicit system: Actor
private val userServiceBuilder: MockUserServiceBuilder = MockUserServiceBuilder()
private val mockTosServiceBuilder = MockTosServiceBuilder()

val mockResourceService = mock[ResourceService]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didnt want to have to add a whole MockResourceServiceBuilder thing just for this so I made this mock available for mocking in the test i wrote

@Ghost-in-a-Jar Ghost-in-a-Jar force-pushed the ID-1174-combined-user-state-api branch from ae94eb9 to e091b55 Compare May 20, 2024 19:32
@Ghost-in-a-Jar Ghost-in-a-Jar force-pushed the ID-1174-combined-user-state-api branch 2 times, most recently from c2b738f to a9475cf Compare May 22, 2024 18:41
@Ghost-in-a-Jar Ghost-in-a-Jar force-pushed the ID-1174-combined-user-state-api branch from 07d63dc to 5911109 Compare May 22, 2024 19:49
Copy link

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
38.1% Duplication on New Code

See analysis details on SonarCloud

@Ghost-in-a-Jar Ghost-in-a-Jar merged commit 2d9c800 into develop May 23, 2024
24 checks passed
@Ghost-in-a-Jar Ghost-in-a-Jar deleted the ID-1174-combined-user-state-api branch May 23, 2024 15:03
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.

3 participants