various small comments

This commit is contained in:
Kim 2023-03-16 16:52:20 +01:00
parent df65b48c8f
commit 91a1c47328
3 changed files with 8 additions and 9 deletions

View File

@ -1,4 +1,3 @@
using System.Security.Cryptography;
using InnovEnergy.App.Backend.Database;
using InnovEnergy.App.Backend.Relations;
@ -37,7 +36,7 @@ public static class SessionMethods
return user is not null
&& folder is not null
&& user.HasWriteAccess
&& user.HasAccessTo(folder) // TODO: && user.HasAccessTo(folder.Parent()) ???
&& user.HasAccessTo(folder)
&& Db.Delete(folder);
}
@ -46,12 +45,14 @@ public static class SessionMethods
{
var user = session?.User;
//Note: keep generation of access _after_ generation of object to prevent "zombie" access-rights.
return user is not null
&& installation is not null
&& user.HasWriteAccess
&& user.HasAccessTo(installation.Parent())
&& Db.Create(installation)
&& InstallationMethods.CreateBucket(installation).Result
&& installation.CreateBucket().Result
&& Db.Create(new InstallationAccess { UserId = user.Id, InstallationId = installation.Id });
}
@ -75,7 +76,7 @@ public static class SessionMethods
return user is not null
&& installation is not null
&& user.HasWriteAccess
&& user.HasAccessTo(installation) // TODO: && user.HasAccessTo(installation.Parent()) ???
&& user.HasAccessTo(installation)
&& Db.Delete(installation);
}

View File

@ -181,9 +181,7 @@ public static class UserMethods
}
// TODO
// TODO?
private static Boolean IsValidEmail(String email)
{
try

View File

@ -21,7 +21,7 @@ public static partial class Db
public static Boolean Create(User user)
{
if (GetUserByEmail(user.Email) is not null) // TODO: User unique by username instead of email?
if (GetUserByEmail(user.Email) is not null)
return false;
user.Password = user.SaltAndHashPassword(user.Password);