Fix duplicate Folders bug
This commit is contained in:
parent
2240d3ef47
commit
ee14c0844b
|
@ -89,19 +89,23 @@ public partial class Db : IDisposable
|
||||||
|
|
||||||
public IEnumerable<Installation> GetAllAccessibleInstallations(User user)
|
public IEnumerable<Installation> GetAllAccessibleInstallations(User user)
|
||||||
{
|
{
|
||||||
var direct = GetDirectlyAccessibleInstallations(user).ToList();
|
var direct = GetDirectlyAccessibleInstallations(user);
|
||||||
var fromFolders = GetAllAccessibleFolders(user)
|
var fromFolders = GetAllAccessibleFolders(user)
|
||||||
.SelectMany(GetChildInstallations)
|
.SelectMany(GetChildInstallations);
|
||||||
.Except(direct);
|
|
||||||
|
|
||||||
return direct.Concat(fromFolders);
|
return direct
|
||||||
|
.Concat(fromFolders)
|
||||||
|
.Distinct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IEnumerable<Folder> GetAllAccessibleFolders(User user)
|
public IEnumerable<Folder> GetAllAccessibleFolders(User user)
|
||||||
{
|
{
|
||||||
return GetDirectlyAccessibleFolders(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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue