RBAC Role Resolver - Users for Account with Role Filter
Learn this problemProblem statement
This continues the RBAC system over a tree of accounts (Organization → Workspace → Team). Find the users who have access to a given account and optionally filter them by required roles.
Inputs: accounts (a String[] of "accountId,parent" where a root uses null as parent), assignments (a String[] of "userId,accountId,role"), accountId (the account to query), and roleFilters (a String[] of required roles).
A user has access to an account if they are assigned any role on that account or on any of its ancestors (roles inherit downward). When roleFilters is non-empty, keep only users who have all of the required roles on that account (counting inherited roles); when roleFilters is empty, return every user with any access.
Return the matching user ids as a String[] sorted alphabetically (no duplicates).
Function
getUsersForAccount(accounts: String[], assignments: String[], accountId: String, roleFilters: String[]) → String[]Examples
Example 1
accounts = ["org_1,null", "wksp_1,org_1"]assignments = ["usr_1,org_1,admin", "usr_1,wksp_1,editor", "usr_2,wksp_1,editor", "usr_3,wksp_1,viewer"]accountId = "wksp_1"roleFilters = []return = ["usr_1", "usr_2", "usr_3"]Example 2
accounts = ["org_1,null", "wksp_1,org_1"]assignments = ["usr_1,org_1,admin", "usr_1,wksp_1,editor", "usr_2,wksp_1,editor", "usr_3,wksp_1,viewer"]accountId = "wksp_1"roleFilters = ["editor"]return = ["usr_1", "usr_2"]Example 3
accounts = ["org_1,null", "wksp_1,org_1"]assignments = ["usr_1,org_1,admin", "usr_1,wksp_1,editor", "usr_2,wksp_1,editor", "usr_3,wksp_1,viewer"]accountId = "wksp_1"roleFilters = ["admin", "editor"]return = ["usr_1"]Constraints
- Each account entry is
"accountId,parent"(root parentnull); one parent per account, no cycles. - Each assignment is
"userId,accountId,role"; roles inherit downward. - A user has access to an account via a role on it or any ancestor.
- With a non-empty
roleFilters, keep only users having all required roles (inherited counted); empty filter returns all users with access. - Return the alphabetically-sorted, de-duplicated
String[]of user ids.
More Stripe problems
- Group Linked Merchant RecordsPHONE SCREEN · Seen Jul 2026
- Invoice / Payment ReconciliationPHONE SCREEN · Seen Jul 2026
- Incident MonitorOA · Seen Jul 2026
- Merchant Fraud Risk ScoringOA · Seen Jul 2026
- WebSocket Load Balancer — Basic Load Balancing (Part 1)OA · Seen Jul 2026
- Rule-Driven Transaction Fraud DetectionOA · PHONE SCREEN · Seen Jul 2026
- Deployment Window SchedulerOA · Seen Jul 2026
- Directly Linked UsersOA · Seen Jun 2026