added python variant of s3cmd
This commit is contained in:
parent
0f7daea8ea
commit
083c412177
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,13 +17,31 @@ public static class InstallationMethods
|
|||
//secret 55MAqyO_FqUmh7O64VIO0egq50ERn_WIAWuc2QC44QU
|
||||
const String apiKey = "EXO44d2979c8e570eae81ead564";
|
||||
const String salt = "3e5b3069-214a-43ee-8d85-57d72000c19d";
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
{
|
||||
var cmd = Cli
|
||||
.Wrap("s3cmd")
|
||||
.WithArguments(new[]
|
||||
{
|
||||
"signurl", $"s3://{installation.Id}-{salt}", validity.TotalSeconds.ToString(), "--access_key",
|
||||
apiKey
|
||||
});
|
||||
|
||||
var cmd = Cli
|
||||
.Wrap("s3cmd")
|
||||
.WithArguments(new[] { "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();
|
||||
installation.S3Url = x.StandardOutput.Replace("\n", "").Replace(" ", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
var cmd = Cli
|
||||
.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(" ", "");
|
||||
}
|
||||
|
||||
Console.WriteLine(installation.S3Url);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
Loading…
Reference in New Issue