Open Snarr opened 4 days ago
This is going to be required for the dashboard to have 100% accurate info on which tenants the principal has access to.
@HazimAr can the dashboard not follow the current 6-step flow outlined above? Or would that flow not respond back with accurate info? Curious to hear more about how this current flow affects the dashboard, because that may make this issue go from low to high priority.
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): PerformRPC SearchTenant
request and use allTenantId
s returned in requestPER_TENANT_ACLS
: (4.5): Parse through the keys of thePER_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: