Zanzana: revert cluster store for fixed roles (#100958)

* Zanzana: revert cluster store for fixed roles

* update go workspace
This commit is contained in:
Alexander Zobnin
2025-02-19 13:53:25 +01:00
committed by GitHub
parent 011726c80f
commit fcb88f6ccc
7 changed files with 6 additions and 51 deletions
+2 -29
View File
@@ -78,11 +78,8 @@ func (s *Server) IsHealthy(ctx context.Context) (bool, error) {
return err == nil, nil
}
func (s *Server) getContextuals(ctx context.Context, subject string) (*openfgav1.ContextualTupleKeys, error) {
contextuals, err := s.getGlobalAuthorizationContext(ctx)
if err != nil {
return nil, err
}
func (s *Server) getContextuals(subject string) (*openfgav1.ContextualTupleKeys, error) {
contextuals := make([]*openfgav1.TupleKey, 0)
if strings.HasPrefix(subject, common.TypeRenderService+":") {
contextuals = append(
@@ -105,27 +102,3 @@ func (s *Server) getContextuals(ctx context.Context, subject string) (*openfgav1
return nil, nil
}
func (s *Server) getGlobalAuthorizationContext(ctx context.Context) ([]*openfgav1.TupleKey, error) {
const cacheKey = "global_authorization_context"
cached, found := s.cache.Get(cacheKey)
if found {
return cached.([]*openfgav1.TupleKey), nil
}
res, err := s.Read(ctx, &authzextv1.ReadRequest{
Namespace: common.ClusterNamespace,
})
if err != nil {
return nil, err
}
contextualTuples := make([]*openfgav1.TupleKey, 0, len(res.GetTuples()))
tuples := common.ToOpenFGATuples(res.GetTuples())
for _, t := range tuples {
contextualTuples = append(contextualTuples, t.GetKey())
}
s.cache.SetDefault(cacheKey, contextualTuples)
return contextualTuples, nil
}