adds newly created inst and folders to accessible

This commit is contained in:
Kim 2023-03-09 16:37:36 +01:00
parent 2fdd920572
commit 2703dd1e11
1 changed files with 5 additions and 9 deletions

View File

@ -252,13 +252,9 @@ public class Controller
if (caller == null || !caller.HasWriteAccess)
return new HttpResponseMessage(HttpStatusCode.Unauthorized);
db.CreateInstallation(installation);
if (db.GetInstallationById(1)!.Name != installation.Name)
{
return new HttpResponseMessage(HttpStatusCode.BadRequest);
}
var id = db.CreateInstallation(installation);
return db.AddToAccessibleInstallations(caller.Id, 1);
return db.AddToAccessibleInstallations(caller.Id, id);
}
@ -269,11 +265,11 @@ public class Controller
{
var caller = GetCaller();
using var db = Db.Connect();
if (caller == null || !caller.HasWriteAccess || db.GetInstallationByName(folder.Name) != null)
if (caller == null || !caller.HasWriteAccess)
return new HttpResponseMessage(HttpStatusCode.Unauthorized);
db.CreateFolder(folder);
return db.AddToAccessibleInstallations(caller.Id, db.GetInstallationByName(folder.Name)!.Id);
var id = db.CreateFolder(folder);
return db.AddToAccessibleFolders(caller.Id, id);
}