Set parentId=0 already in DB layer, not in controller
This commit is contained in:
parent
e6fa2933b5
commit
faf35be6cf
|
@ -174,8 +174,7 @@ public class Controller
|
||||||
using var db = Db.Connect();
|
using var db = Db.Connect();
|
||||||
|
|
||||||
var folders = db
|
var folders = db
|
||||||
.GetDirectlyAccessibleFolders(caller)
|
.GetDirectlyAccessibleFolders(caller) // ReSharper disable once AccessToDisposedClosure
|
||||||
.Do(f => f.ParentId = 0) // ReSharper disable once AccessToDisposedClosure
|
|
||||||
.Select(f => PopulateChildren(db, f));
|
.Select(f => PopulateChildren(db, f));
|
||||||
|
|
||||||
var installations = db.GetDirectlyAccessibleInstallations(caller);
|
var installations = db.GetDirectlyAccessibleInstallations(caller);
|
||||||
|
|
|
@ -111,7 +111,8 @@ public partial class Db : IDisposable
|
||||||
.Where(r => r.UserId == user.Id)
|
.Where(r => r.UserId == user.Id)
|
||||||
.Select(r => r.InstallationId)
|
.Select(r => r.InstallationId)
|
||||||
.Select(GetInstallationById)
|
.Select(GetInstallationById)
|
||||||
.NotNull();
|
.NotNull()
|
||||||
|
.Do(i => i.ParentId = 0); // hide inaccessible parents from calling user
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Folder> GetDirectlyAccessibleFolders(User user)
|
public IEnumerable<Folder> GetDirectlyAccessibleFolders(User user)
|
||||||
|
@ -120,7 +121,8 @@ public partial class Db : IDisposable
|
||||||
.Where(r => r.UserId == user.Id)
|
.Where(r => r.UserId == user.Id)
|
||||||
.Select(r => r.FolderId)
|
.Select(r => r.FolderId)
|
||||||
.Select(GetFolderById)
|
.Select(GetFolderById)
|
||||||
.NotNull();
|
.NotNull()
|
||||||
|
.Do(i => i.ParentId = 0); // hide inaccessible parents from calling user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result AddToAccessibleInstallations(Int64 userId, Int64 updatedInstallationId)
|
public Result AddToAccessibleInstallations(Int64 userId, Int64 updatedInstallationId)
|
||||||
|
|
Loading…
Reference in New Issue