From 8f27f2f9deb76effc2fc55ba91a6b09fe834fa8a Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Tue, 15 Feb 2022 16:19:08 -0500 Subject: [PATCH 1/4] Make the DMAPI didn't validate error more descriptive --- build/Version.props | 6 +++--- src/Tgstation.Server.Api/Models/ErrorCode.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/Version.props b/build/Version.props index 5a7f9f8197..132159e2c4 100644 --- a/build/Version.props +++ b/build/Version.props @@ -3,10 +3,10 @@ - 4.16.1 + 4.16.2 4.1.0 - 9.3.0 - 9.3.1 + 9.3.1 + 9.3.2 10.4.1 6.0.4 5.3.0 diff --git a/src/Tgstation.Server.Api/Models/ErrorCode.cs b/src/Tgstation.Server.Api/Models/ErrorCode.cs index f861b24cbb..2f42896133 100644 --- a/src/Tgstation.Server.Api/Models/ErrorCode.cs +++ b/src/Tgstation.Server.Api/Models/ErrorCode.cs @@ -327,7 +327,7 @@ namespace Tgstation.Server.Api.Models /// /// The DMAPI never validated itself /// - [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, /// From 3e5352c434ed7573f427f91aae42cc61a0e304eb Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Tue, 15 Feb 2022 16:28:30 -0500 Subject: [PATCH 2/4] Fixes #1354 - Cloning with credentials now requires the ability to change credentials. - Committer details set on clone now save. --- .../Controllers/RepositoryController.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Controllers/RepositoryController.cs b/src/Tgstation.Server.Host/Controllers/RepositoryController.cs index e2d7098b87..fcbbcea16e 100644 --- a/src/Tgstation.Server.Host/Controllers/RepositoryController.cs +++ b/src/Tgstation.Server.Host/Controllers/RepositoryController.cs @@ -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; From 69b870dcdf016e27db05aa0d2ad83274a36421c9 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Tue, 15 Feb 2022 16:58:31 -0500 Subject: [PATCH 3/4] Increase timeout on BYOND install test --- tests/Tgstation.Server.Tests/Instance/ByondTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Tgstation.Server.Tests/Instance/ByondTest.cs b/tests/Tgstation.Server.Tests/Instance/ByondTest.cs index afaa705ea9..1c9c715816 100644 --- a/tests/Tgstation.Server.Tests/Instance/ByondTest.cs +++ b/tests/Tgstation.Server.Tests/Instance/ByondTest.cs @@ -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); From 00984c8f421c328b40ec84ebae8985b85ee1d051 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Tue, 15 Feb 2022 17:01:03 -0500 Subject: [PATCH 4/4] Minor sanity check in user/group/perm test --- tests/Tgstation.Server.Tests/UsersTest.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/Tgstation.Server.Tests/UsersTest.cs b/tests/Tgstation.Server.Tests/UsersTest.cs index cdded81e86..b09873bc12 100644 --- a/tests/Tgstation.Server.Tests/UsersTest.cs +++ b/tests/Tgstation.Server.Tests/UsersTest.cs @@ -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(), + InstanceManagerRights = RightsHelper.AllRights(), + }; + + testUser2 = await serverClient.Users.Update(testUserUpdate, cancellationToken); + Assert.IsNull(testUser2.Group); + Assert.IsNotNull(testUser2.PermissionSet); } async Task TestCreateSysUser(CancellationToken cancellationToken)