various small comments
This commit is contained in:
parent
df65b48c8f
commit
91a1c47328
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -180,10 +180,8 @@ public static class UserMethods
|
|||
return $"{user.Id}InnovEnergy";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO
|
||||
|
||||
// TODO?
|
||||
private static Boolean IsValidEmail(String email)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue