From ee14c0844be483025b9a3ded42587bfb42dcea8e Mon Sep 17 00:00:00 2001 From: ig Date: Wed, 8 Mar 2023 15:45:53 +0100 Subject: [PATCH] Fix duplicate Folders bug --- csharp/App/Backend/Database/Db.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/csharp/App/Backend/Database/Db.cs b/csharp/App/Backend/Database/Db.cs index 1625c128f..5c87cc9c8 100644 --- a/csharp/App/Backend/Database/Db.cs +++ b/csharp/App/Backend/Database/Db.cs @@ -89,19 +89,23 @@ public partial class Db : IDisposable public IEnumerable GetAllAccessibleInstallations(User user) { - var direct = GetDirectlyAccessibleInstallations(user).ToList(); + var direct = GetDirectlyAccessibleInstallations(user); var fromFolders = GetAllAccessibleFolders(user) - .SelectMany(GetChildInstallations) - .Except(direct); + .SelectMany(GetChildInstallations); - return direct.Concat(fromFolders); + return direct + .Concat(fromFolders) + .Distinct(); } - public IEnumerable GetAllAccessibleFolders(User user) { return GetDirectlyAccessibleFolders(user) - .SelectMany(GetDescendantFolders); + .SelectMany(GetDescendantFolders) + .Distinct(); + + // Distinct because the user might have direct access + // to a child folder of a folder he has already access to }