Fix AccessibleFolders
This commit is contained in:
parent
4a19ebd49c
commit
44e183a9f1
|
@ -74,7 +74,7 @@ public static class FolderMethods
|
|||
|
||||
public static Boolean IsRelativeRoot(this Folder folder)
|
||||
{
|
||||
return folder.ParentId < 0; // root has ParentId 0 by definition
|
||||
return folder.ParentId < 0;
|
||||
}
|
||||
|
||||
public static Boolean WasMoved(this Folder folder)
|
||||
|
|
|
@ -27,7 +27,7 @@ public static class UserMethods
|
|||
{
|
||||
return user
|
||||
.DirectlyAccessibleFolders()
|
||||
.SelectMany(f => f.DescendantFolders())
|
||||
.SelectMany(f => f.DescendantFolders().Prepend(f))
|
||||
.Distinct();
|
||||
|
||||
// Distinct because the user might have direct access
|
||||
|
@ -51,7 +51,7 @@ public static class UserMethods
|
|||
.Select(r => r.InstallationId)
|
||||
.Select(Db.GetInstallationById)
|
||||
.NotNull()
|
||||
.Do(i => i.ParentId = -1); // hide inaccessible parents from calling user
|
||||
.Do(i => i.ParentId = 0); // hide inaccessible parents from calling user
|
||||
}
|
||||
|
||||
public static IEnumerable<Folder> DirectlyAccessibleFolders(this User user)
|
||||
|
@ -62,7 +62,7 @@ public static class UserMethods
|
|||
.Select(r => r.FolderId)
|
||||
.Select(Db.GetFolderById)
|
||||
.NotNull()
|
||||
.Do(i => i.ParentId = -1); // hide inaccessible parents from calling user;
|
||||
.Do(i => i.ParentId = 0); // hide inaccessible parents from calling user;
|
||||
}
|
||||
|
||||
public static IEnumerable<User> ChildUsers(this User parent)
|
||||
|
@ -172,6 +172,12 @@ public static class UserMethods
|
|||
.Ancestors()
|
||||
.Contains(user);
|
||||
}
|
||||
|
||||
public static Boolean IsRelativeRoot(this User user, Installation i)
|
||||
{
|
||||
// TODO: determine not by id but by accessibility
|
||||
return i.ParentId < 0;
|
||||
}
|
||||
|
||||
public static String Salt(this User user)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue