Repository navigation
Description
As part of revamping the user access (roles and privileges), the various Entities UIs have declared a large number of "Authorized Actions" (ie, permissions for various actions). Ref: spreadsheet.
It was originally anticipated that these permissions would be mapped to "roles" in Keycloak and/or Auth db. However, the current KC roles system is already nearing its capacity. Also, managing 50+ new permissions would be complex. Also, we don't want to pollute the account login token with so many Entities-specific permissions since the token is used for other products.
A new design was proposed in a meeting on May 22, 2025 with Severin, John, Travis and Mihai. Here are the key pieces:
-
The work done to replace "is user staff" with "is authorized (action)" in the Entity UIs needs to be completed as planned. Out of this, over 50 new "authorized actions" (permissions) will be declared.
-
The role-to-permission mapping, that was originally envisioned to be in KC/Auth, should now be stored in Legal db. It can be static for now -- we can just provision it once and make changes later directly or via migration scripts. A UI to manage it is not in scope at the moment.
-
A new endpoint is needed in Legal API to provide the authorized actions to the UIs. No parameters are needed. The Legal API will look at the caller's bearer token and determine which one of the roles (account types) the current user is. These roles (which are mutually exclusive) are:
- "staff" - REGI staff
- "sbc_staff" - SBC Staff (tier 1 and tier 2 to be determined later)
- "maximus_staff" - Maximus Help Desk staff
- "contact_centre_staff - SBC Contact Centre staff (was previously BCOL Help Desk)
- "public_user" - regular user
-
Once the Legal API has determined which account type this is, it will look up all its applicable Authorized Actions (aka permissions) in a table, and return that to the calling UI.
-
The UI will receive the list of Authorized Actions and will enable/disable code accordingly. Some simple UI changes (see tickets below) will be needed to change over from fetching authorizations from Auth API to Legal API (and removing the mapping tables currently hard-coded).
As a future enhancement, a second table in Legal API could be used to map the account's permissions per business (instead of overall). This might require a parameter (for business id) in the GET call / endpoint.
As a future enhancement, a (staff) UI could be created to manage the roles / authorized actions table.
cc: @vysakh-menon-aot @ketaki-deodhar @chenhongjing @argush3 @thorwolpert @seeker25
Activity
severinbeauvais commentedon May 23, 2025
cc: @OlgaPotiagalova @JohnamLane @Mihai-QuickSilverDev
severinbeauvais commentedon May 23, 2025
cc: @JazzarKarim @bobdev-94 @TVWerdal
[-]EPIC: store role-permissions mappings in Legal db[/-][+]EPIC: store roles-permissions mappings in Legal db[/+]seeker25 commentedon May 23, 2025
Looks great thank you Severin
thorwolpert commentedon May 23, 2025
I see 5 roles listed, where does the 50 mentioned come from?
Instead of only being in an issue ticket, an RFC would be a nice recorded history of this?
10 remaining items
severinbeauvais commentedon May 26, 2025
Ah! So service accounts are sometimes assigned a unique role, so they could be handled like user account types.
(Authorized Actions, while UI-centric at the moment, don't have to be limited to UI only.)
SYSTEM is mutually exclusive with the other account types, right?
seeker25 commentedon May 26, 2025
not always
severinbeauvais commentedon May 26, 2025
Should we check for roles in a specific order then? Eg, if both SYSTEM and STAFF, use SYSTEM?
Or should we combine the results for multiple roles?
seeker25 commentedon May 26, 2025
I think specific order is easiest for now, just remember only service accounts will have SYSTEM so it's fairly small amount
But keep in mind any client with the audience mapping for entities should be able to call into LEAR with SYSTEM.
Could throw an exception if two conflicting roles are detected, but that's up to entities
chenhongjing commentedon May 26, 2025
(Get better understanding after chatting with @seeker25, thx!)
Yes, that makes sense - the SYSTEM role discussion doesn't need to block UI progress, but it might be helpful to keep this conversation going in the background. We probably need more investigation when we start API integration.
Just reference:
Legal API uses STAFF if both exist
severinbeauvais commentedon May 27, 2025
Interesting. I wonder if there's more LEAR code that does this same check...?
Also, do we know what actions SYSTEM is authorized to do?
Anyway, can we continue this discussion in ticket #27211?
[-]EPIC: store roles-permissions mappings in Legal db[/-][+]EPIC: move roles-permissions mappings to Legal db[/+][-]EPIC: move roles-permissions mappings to Legal db[/-][+]EPIC: store roles-permissions mappings in Legal db[/+][-]EPIC: store roles-permissions mappings in Legal db[/-][+]Store roles-permissions mappings in Legal DB (Phase 2)[/+]