From df65b48c8fd55e4766d7227bd69199751360d084 Mon Sep 17 00:00:00 2001 From: Kim Date: Thu, 16 Mar 2023 16:45:25 +0100 Subject: [PATCH] creating new folders and installations now gives you access to the new folder/installation --- csharp/App/Backend/DataTypes/Methods/Installation.cs | 5 ++--- csharp/App/Backend/DataTypes/Methods/Session.cs | 8 +++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/csharp/App/Backend/DataTypes/Methods/Installation.cs b/csharp/App/Backend/DataTypes/Methods/Installation.cs index be76d69a7..608827041 100644 --- a/csharp/App/Backend/DataTypes/Methods/Installation.cs +++ b/csharp/App/Backend/DataTypes/Methods/Installation.cs @@ -48,7 +48,7 @@ public static class InstallationMethods }); var x = await cmd.ExecuteBufferedAsync(); - //Updating the url in the db as to not needing to wait until the next + //Updating the url in the db as not wait until the next bi-daily update var cmd2 = Cli .Wrap("python3") .WithArguments(new[] @@ -81,8 +81,7 @@ public static class InstallationMethods var x = await cmd.ExecuteBufferedAsync(); return x.ExitCode == 0; } - - + public static IEnumerable UsersWithAccess(this Installation installation) { return UsersWithDirectAccess(installation).Concat(UsersWithInheritedAccess(installation)); diff --git a/csharp/App/Backend/DataTypes/Methods/Session.cs b/csharp/App/Backend/DataTypes/Methods/Session.cs index 6cc3616c6..394aadafd 100644 --- a/csharp/App/Backend/DataTypes/Methods/Session.cs +++ b/csharp/App/Backend/DataTypes/Methods/Session.cs @@ -9,12 +9,13 @@ public static class SessionMethods public static Boolean Create(this Session? session, Folder? folder) { var user = session?.User; - + return user is not null && folder is not null && user.HasWriteAccess && user.HasAccessTo(folder.Parent()) - && Db.Create(folder); + && Db.Create(folder) + && Db.Create(new FolderAccess() { UserId = user.Id, FolderId = folder.Id }); } public static Boolean Update(this Session? session, Folder? folder) @@ -50,7 +51,8 @@ public static class SessionMethods && user.HasWriteAccess && user.HasAccessTo(installation.Parent()) && Db.Create(installation) - && InstallationMethods.CreateBucket(installation).Result; + && InstallationMethods.CreateBucket(installation).Result + && Db.Create(new InstallationAccess { UserId = user.Id, InstallationId = installation.Id }); } public static Boolean Update(this Session? session, Installation? installation)