Access Control: Clear user's permission cache after resource creation (#59101)
* refresh user's permission cache after resource creation * clear the cache instead of reloading the permissions * don't error if can't clear cache * fix tests * fix tests again
This commit is contained in:
@@ -147,6 +147,14 @@ func (s *Service) getCachedUserPermissions(ctx context.Context, user *user.Signe
|
||||
return permissions, nil
|
||||
}
|
||||
|
||||
func (s *Service) ClearUserPermissionCache(user *user.SignedInUser) {
|
||||
key, err := permissionCacheKey(user)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
s.cache.Delete(key)
|
||||
}
|
||||
|
||||
func (s *Service) DeleteUserPermissions(ctx context.Context, orgID int64, userID int64) error {
|
||||
return s.store.DeleteUserPermissions(ctx, orgID, userID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user