creating new folders and installations now gives you access to the new folder/installation

This commit is contained in:
Kim 2023-03-16 16:45:25 +01:00
parent 4eac790eaa
commit df65b48c8f
2 changed files with 7 additions and 6 deletions

View File

@ -48,7 +48,7 @@ public static class InstallationMethods
}); });
var x = await cmd.ExecuteBufferedAsync(); 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 var cmd2 = Cli
.Wrap("python3") .Wrap("python3")
.WithArguments(new[] .WithArguments(new[]
@ -81,8 +81,7 @@ public static class InstallationMethods
var x = await cmd.ExecuteBufferedAsync(); var x = await cmd.ExecuteBufferedAsync();
return x.ExitCode == 0; return x.ExitCode == 0;
} }
public static IEnumerable<User> UsersWithAccess(this Installation installation) public static IEnumerable<User> UsersWithAccess(this Installation installation)
{ {
return UsersWithDirectAccess(installation).Concat(UsersWithInheritedAccess(installation)); return UsersWithDirectAccess(installation).Concat(UsersWithInheritedAccess(installation));

View File

@ -9,12 +9,13 @@ public static class SessionMethods
public static Boolean Create(this Session? session, Folder? folder) public static Boolean Create(this Session? session, Folder? folder)
{ {
var user = session?.User; var user = session?.User;
return user is not null return user is not null
&& folder is not null && folder is not null
&& user.HasWriteAccess && user.HasWriteAccess
&& user.HasAccessTo(folder.Parent()) && 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) public static Boolean Update(this Session? session, Folder? folder)
@ -50,7 +51,8 @@ public static class SessionMethods
&& user.HasWriteAccess && user.HasWriteAccess
&& user.HasAccessTo(installation.Parent()) && user.HasAccessTo(installation.Parent())
&& Db.Create(installation) && 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) public static Boolean Update(this Session? session, Installation? installation)