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" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources" />
</ItemGroup>
<ItemGroup>
<None Update="Resources\s3cmd.py">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

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

View File

@ -17,11 +17,13 @@ public static class InstallationMethods
//secret 55MAqyO_FqUmh7O64VIO0egq50ERn_WIAWuc2QC44QU
const String apiKey = "EXO44d2979c8e570eae81ead564";
const String salt = "3e5b3069-214a-43ee-8d85-57d72000c19d";
var cmd = Cli
.Wrap("s3cmd")
.WithArguments(new[] { "signurl",$"s3://{installation.Id}-{salt}", validity.TotalSeconds.ToString(), "--access_key", apiKey});
.Wrap("python3")
.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(" ", "");

View File

@ -95,7 +95,7 @@ public static class SessionMethods
&& editedUser is not null
&& sessionUser.HasWriteAccess
&& 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);
}

View File

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

View File

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

File diff suppressed because it is too large Load Diff

Binary file not shown.