[release-11.6.3] RBAC: Dont additionally cache all users permissions (#106146)
RBAC: Don't additionally cache all users permissions (#105607)
* RBAC: Don't additionally cache all users permissions
* remove unused tests
(cherry picked from commit cfba630f5c)
This commit is contained in:
@@ -251,11 +251,6 @@ func (s *Service) getCachedUserPermissions(ctx context.Context, user identity.Re
|
||||
ctx, span := tracer.Start(ctx, "accesscontrol.acimpl.getCachedUserPermissions")
|
||||
defer span.End()
|
||||
|
||||
cacheKey := accesscontrol.GetUserPermissionCacheKey(user)
|
||||
if cachedPermissions, ok := s.cache.Get(cacheKey); ok {
|
||||
return cachedPermissions.([]accesscontrol.Permission), nil
|
||||
}
|
||||
|
||||
permissions, err := s.getCachedBasicRolesPermissions(ctx, user, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -271,9 +266,7 @@ func (s *Service) getCachedUserPermissions(ctx context.Context, user identity.Re
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
permissions = append(permissions, userManagedPermissions...)
|
||||
s.cache.Set(cacheKey, permissions, cacheTTL)
|
||||
span.SetAttributes(attribute.Int("num_permissions", len(permissions)))
|
||||
|
||||
return permissions, nil
|
||||
@@ -398,7 +391,6 @@ func (s *Service) getCachedTeamsPermissions(ctx context.Context, user identity.R
|
||||
}
|
||||
|
||||
func (s *Service) ClearUserPermissionCache(user identity.Requester) {
|
||||
s.cache.Delete(accesscontrol.GetUserPermissionCacheKey(user))
|
||||
s.cache.Delete(accesscontrol.GetUserDirectPermissionCacheKey(user))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user