Simplify logic for revealing Tenants that a Principal has access to #1162
Labels
clients
Affects all LH clients and the public API. May be used in conjunction with `server`.
controversial
Requires discussion from the community. For proposals, API changes, and big features.
feature
Issue that denotes a new feature, request, or performance improvement.
server
Affects the core LH Server code.
Milestone
Currently, revealing the
Tenant
s that aPrincipal
has access to requires parsing through thePrincipal
object and conditionally performing an additional RPC request. This issue documents that complex flow and proposes possible solutions to simplify the user experience.Current Flow
RPC WhoAmI
orRPC GetPrincipal
requestGLOBAL_ACLS
to performREAD
action overTENANT
resource:(3.5): Perform
RPC SearchTenant
request and use allTenantId
s returned in requestPER_TENANT_ACLS
:(4.5): Parse through the keys of the
PER_TENANT_ACLS
in the object and use theTenantId
s returned in requestAlternatives
If LittleHorse users find themselves implementing this flow very often, we should be considerate and supply an out-of-the-box solution as an alternative to this complex flow.
Here are some alternative ideas:
1. Add an
RPC ListTenantsForPrincipal
We add an RPC that takes in a
PrincipalId
and returns a list ofTenantId
s. The server handles all of this logic internally for discovering whatTenant
s aPrincipal
has access to.Pros:
Cons:
This could be reduced to 1 step if the RPC behaves as
RPC ListTenantsForCurrentPrincipal
and infers Principal similar toRPC Whoami
2. Add an SDK method
ListTenantsForPrincipal
We add an SDK method to each of our SDK libraries that takes in a
PrincipalId
and returns a list ofTenantId
s. The SDK method bundles the same steps listed above into a single method, abstracting away the messy flow.New Flow:
ListTenantsForPrincipal(principalId)
methodPros:
Cons:
3. Change the implementation of
RPC SearchTenant
Currently,
RPC SearchTenant
can only be called byPrincipal
s withGLOBAL_ACLS
to perform theREAD
action over theTENANT
resource (or higher permissions).This solution proposes that we refactor
RPC SearchTenant
to be used by any Principal that wants to know whatTenant
s it has access to.Principals would perform an
RPC SearchTenant
request and the server would return all of theTenant
s thatPrincipal
has permissions over.Pros:
Cons:
The text was updated successfully, but these errors were encountered: