This commit is contained in:
Sina Blattmann 2023-03-16 12:50:34 +01:00
commit e77dc5f2b6
8 changed files with 3416 additions and 13 deletions

View File

@ -27,4 +27,18 @@
<ProjectReference Include="../../Lib/Utils/Utils.csproj" /> <ProjectReference Include="../../Lib/Utils/Utils.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Resources" />
</ItemGroup>
<ItemGroup>
<None Update="Resources\s3cmd.py">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project> </Project>

View File

@ -59,7 +59,8 @@ public class Controller
if (user is null || !caller.HasAccessTo(user)) if (user is null || !caller.HasAccessTo(user))
return _Unauthorized; return _Unauthorized;
user.Password = "";
return user; return user;
} }
@ -200,9 +201,9 @@ public class Controller
{ {
var session = GetSession(); var session = GetSession();
return session.Update(updatedUser) if (!session.Update(updatedUser)) return _Unauthorized;
? updatedUser updatedUser.Password = "";
: _Unauthorized; return updatedUser;
} }

View File

@ -17,15 +17,17 @@ public static class InstallationMethods
//secret 55MAqyO_FqUmh7O64VIO0egq50ERn_WIAWuc2QC44QU //secret 55MAqyO_FqUmh7O64VIO0egq50ERn_WIAWuc2QC44QU
const String apiKey = "EXO44d2979c8e570eae81ead564"; const String apiKey = "EXO44d2979c8e570eae81ead564";
const String salt = "3e5b3069-214a-43ee-8d85-57d72000c19d"; const String salt = "3e5b3069-214a-43ee-8d85-57d72000c19d";
var cmd = Cli var cmd = Cli
.Wrap("s3cmd") .Wrap("python3")
.WithArguments(new[] { "signurl",$"s3://{installation.Id}-{salt}", validity.TotalSeconds.ToString(), "--access_key", apiKey}); .WithArguments(new[]
{
"Resources/s3cmd.py", "signurl", $"s3://{installation.Id}-{salt}", validity.TotalSeconds.ToString(), "--access_key",
apiKey
});
var x = await cmd.ExecuteBufferedAsync();
installation.S3Url = x.StandardOutput.Replace("\n", "").Replace(" ", "");
var x = await cmd.ExecuteBufferedAsync(); Console.WriteLine(installation.S3Url);
installation.S3Url = x.StandardOutput.Replace("\n", "").Replace(" ", "");
Console.WriteLine(installation.S3Url);
Db.Update(installation); Db.Update(installation);
} }

View File

@ -95,7 +95,7 @@ public static class SessionMethods
&& editedUser is not null && editedUser is not null
&& sessionUser.HasWriteAccess && sessionUser.HasWriteAccess
&& sessionUser.HasAccessTo(editedUser) && sessionUser.HasAccessTo(editedUser)
&& (editedUser.IsRelativeRoot() || sessionUser.HasAccessTo(editedUser.Parent())) // TODO: triple check this //&& (editedUser.IsRelativeRoot() || sessionUser.HasAccessTo(editedUser.Parent())) // TODO: triple check this
&& Db.Update(editedUser); && Db.Update(editedUser);
} }

View File

@ -160,6 +160,9 @@ public static class UserMethods
{ {
if (other is null) if (other is null)
return false; return false;
if (other.Id == user.Id)
return true;
return other return other
.Ancestors() .Ancestors()

View File

@ -40,7 +40,10 @@ public static partial class Db
public static Boolean Update(User user) public static Boolean Update(User user)
{ {
var originalUser = GetUserById(user.Id); var originalUser = GetUserById(user.Id);
//Todo change password backend
user.Password = originalUser.Password;
return originalUser is not null return originalUser is not null
&& user.Id == originalUser.Id // these columns must not be modified! && user.Id == originalUser.Id // these columns must not be modified!
&& user.ParentId == originalUser.ParentId && user.ParentId == originalUser.ParentId

File diff suppressed because it is too large Load Diff

Binary file not shown.