Merge pull request #1359 from tgstation/DMAPIDesc [TGSDeploy]

Make the DMAPI didn't validate error more descriptive
This commit is contained in:
Jordan
2022-02-15 17:47:47 -05:00
committed by GitHub
5 changed files with 28 additions and 8 deletions
+3 -3
View File
@@ -3,10 +3,10 @@
<!-- Integration tests will ensure they match across the board -->
<Import Project="ControlPanelVersion.props" />
<PropertyGroup>
<TgsCoreVersion>4.16.1</TgsCoreVersion>
<TgsCoreVersion>4.16.2</TgsCoreVersion>
<TgsConfigVersion>4.1.0</TgsConfigVersion>
<TgsApiVersion>9.3.0</TgsApiVersion>
<TgsApiLibraryVersion>9.3.1</TgsApiLibraryVersion>
<TgsApiVersion>9.3.1</TgsApiVersion>
<TgsApiLibraryVersion>9.3.2</TgsApiLibraryVersion>
<TgsClientVersion>10.4.1</TgsClientVersion>
<TgsDmapiVersion>6.0.4</TgsDmapiVersion>
<TgsInteropVersion>5.3.0</TgsInteropVersion>
+1 -1
View File
@@ -327,7 +327,7 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// The DMAPI never validated itself
/// </summary>
[Description("DreamDaemon did not validate the DMAPI!")]
[Description("DreamDaemon did not validate the DMAPI! This can occur if your world is encountering runtime errors during startup.")]
DreamMakerNeverValidated,
/// <summary>
@@ -91,6 +91,11 @@ namespace Tgstation.Server.Host.Controllers
if (model.AccessUser == null ^ model.AccessToken == null)
return BadRequest(ErrorCode.RepoMismatchUserAndAccessToken);
var userRights = (RepositoryRights)AuthenticationContext.GetRight(RightsType.Repository);
if (((model.AccessUser ?? model.AccessToken) != null && !userRights.HasFlag(RepositoryRights.ChangeCredentials))
|| ((model.CommitterEmail ?? model.CommitterName) != null && !userRights.HasFlag(RepositoryRights.ChangeCommitter)))
return Forbid();
#pragma warning disable CS0618 // Support for obsolete API field
model.UpdateSubmodules ??= model.RecurseSubmodules;
#pragma warning restore CS0618
@@ -107,7 +112,11 @@ namespace Tgstation.Server.Host.Controllers
currentModel.UpdateSubmodules = model.UpdateSubmodules ?? true;
currentModel.AccessToken = model.AccessToken;
currentModel.AccessUser = model.AccessUser; // intentionally only these fields, user not allowed to change anything else atm
currentModel.AccessUser = model.AccessUser;
currentModel.CommitterEmail = model.CommitterEmail ?? currentModel.CommitterEmail;
currentModel.CommitterName = model.CommitterName ?? currentModel.CommitterName;
var cloneBranch = model.Reference;
var origin = model.Origin;
@@ -1,4 +1,4 @@
using Castle.Core.Logging;
using Castle.Core.Logging;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
@@ -60,7 +60,7 @@ namespace Tgstation.Server.Tests.Instance
};
var test = await byondClient.SetActiveVersion(newModel, null, cancellationToken).ConfigureAwait(false);
Assert.IsNotNull(test.InstallJob);
await WaitForJob(test.InstallJob, 120, false, null, cancellationToken).ConfigureAwait(false);
await WaitForJob(test.InstallJob, 180, false, null, cancellationToken).ConfigureAwait(false);
var currentShit = await byondClient.ActiveVersion(cancellationToken).ConfigureAwait(false);
Assert.AreEqual(newModel.Version.Semver(), currentShit.Version);
+12 -1
View File
@@ -1,4 +1,4 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -193,6 +193,17 @@ namespace Tgstation.Server.Tests
Assert.AreEqual(1, group.Users.Count);
Assert.AreEqual(testUser2.Id, group.Users.First().Id);
Assert.IsNotNull(group.PermissionSet);
testUserUpdate.Group = null;
testUserUpdate.PermissionSet = new PermissionSet
{
AdministrationRights = RightsHelper.AllRights<AdministrationRights>(),
InstanceManagerRights = RightsHelper.AllRights<InstanceManagerRights>(),
};
testUser2 = await serverClient.Users.Update(testUserUpdate, cancellationToken);
Assert.IsNull(testUser2.Group);
Assert.IsNotNull(testUser2.PermissionSet);
}
async Task TestCreateSysUser(CancellationToken cancellationToken)