Skip to content

Store roles-permissions mappings in Legal DB (Phase 2) #28599

Closed
8 of 8 issues completed
Closed

Description

@severinbeauvais

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:

  1. 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.

  2. 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.

  3. 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
  4. 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.

  5. 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

Sub-issues

Sub-issues

8 of 8 Issues completed
Loading 8 sub-issues

Activity

  1. added
    Entities Team
    on May 23, 2025
  2. severinbeauvais commented on May 23, 2025

    @severinbeauvais
    CollaboratorAuthor
  3. severinbeauvais commented on May 23, 2025

    @severinbeauvais
    CollaboratorAuthor
  4. changed the title [-]EPIC: store role-permissions mappings in Legal db[/-] [+]EPIC: store roles-permissions mappings in Legal db[/+] on May 23, 2025
  5. seeker25 commented on May 23, 2025

    @seeker25
    Contributor

    Looks great thank you Severin

  6. thorwolpert commented on May 23, 2025

    @thorwolpert
    Collaborator

    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?

  7. 10 remaining items

  8. severinbeauvais commented on May 26, 2025

    @severinbeauvais
    CollaboratorAuthor

    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?

  9. seeker25 commented on May 26, 2025

    @seeker25
    Contributor

    not always

  10. severinbeauvais commented on May 26, 2025

    @severinbeauvais
    CollaboratorAuthor

    not always

    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?

  11. seeker25 commented on May 26, 2025

    @seeker25
    Contributor

    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

  12. chenhongjing commented on May 26, 2025

    @chenhongjing

    My immediate concern is the near-term requirement for the UIs: how to get a list of Authorized Actions for the current account role.
    Ideally the same checks would be done by the API

    (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.

    Should we check for roles in specific order then?
    specific order is easiest for now

    Just reference:
    Legal API uses STAFF if both exist

  13. severinbeauvais commented on May 27, 2025

    @severinbeauvais
    CollaboratorAuthor

    Just reference: Legal API uses STAFF if both exist

    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?

  14. changed the title [-]EPIC: store roles-permissions mappings in Legal db[/-] [+]EPIC: move roles-permissions mappings to Legal db[/+] on May 27, 2025
  15. changed the title [-]EPIC: move roles-permissions mappings to Legal db[/-] [+]EPIC: store roles-permissions mappings in Legal db[/+] on May 27, 2025
  16. changed the title [-]EPIC: store roles-permissions mappings in Legal db[/-] [+]Store roles-permissions mappings in Legal DB (Phase 2)[/+] on Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Entities Team

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions