From 2b4d43e7eb235745b6d80720bade29902f5d66f1 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Fri, 28 Sep 2018 15:01:18 -0400 Subject: [PATCH 1/3] Add database engine as prerequisite in the readme --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d7c3594163..76a3926e9f 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,16 @@ This is a toolset to manage production BYOND servers. It includes the ability to ## Setup +### Pre-Requisites + +- [.NET Core Runtime (>= v2.1)](https://www.microsoft.com/net/download) If you plan to install tgstation-server as a Windows service, you should also ensure that your .NET Framework runtime version is >= v4.7.1 (Download can be found on same page). On Windows, ensure that the `dotnet` executable file is in your system's `PATH` variable (or the user's that will be running the server). +- A [MariaDB](https://downloads.mariadb.org/), MySQL, or [Microsoft SQL Server](https://www.microsoft.com/en-us/download/details.aspx?id=55994) database engine is required + ### Installation -1. Download and install the [.NET Core Runtime (>= v2.1)](https://www.microsoft.com/net/download) for your system. If you plan to install tgstation-server as a Windows service, you should also ensure that your .NET Framework runtime version is >= v4.7.1 (Download can be found on same page). On Windows, ensure that the `dotnet` executable file is in your system's `PATH` variable (or the user's that will be running the server). -2. [Download the latest V4 release .zip](https://github.com/tgstation/tgstation-server/releases/latest). The ServerService package will only work on Windows. Choose ServerConsole if that is not your target OS or you prefer not to use the Windows service. -3. Extract the .zip file to where you want the server to run from. Note the account running the server must have write access to the `lib` subdirectory. -4. If using the ServerService package, run `Tgstation.Server.Host.Service.exe`. It should prompt you to install the service. Click `Yes` and accept a potential UAC elevation prompt. You should now be able to control the service using the Windows service control commandlet. +1. [Download the latest V4 release .zip](https://github.com/tgstation/tgstation-server/releases/latest). The ServerService package will only work on Windows. Choose ServerConsole if that is not your target OS or you prefer not to use the Windows service. +2. Extract the .zip file to where you want the server to run from. Note the account running the server must have write access to the `lib` subdirectory. +3. If using the ServerService package, run `Tgstation.Server.Host.Service.exe`. It should prompt you to install the service. Click `Yes` and accept a potential UAC elevation prompt. You should now be able to control the service using the Windows service control commandlet. #### Linux From e09410b35a8632e731e28dd547d176e325c0289a Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Fri, 28 Sep 2018 15:44:50 -0400 Subject: [PATCH 2/3] Fix instance user permission fixing --- src/Tgstation.Server.Host/Controllers/InstanceController.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Controllers/InstanceController.cs b/src/Tgstation.Server.Host/Controllers/InstanceController.cs index 9e4c89d63a..5d6515dc7b 100644 --- a/src/Tgstation.Server.Host/Controllers/InstanceController.cs +++ b/src/Tgstation.Server.Host/Controllers/InstanceController.cs @@ -310,7 +310,11 @@ namespace Tgstation.Server.Host.Controllers //ensure the current user has write privilege on the instance var usersInstanceUser = await usersInstanceUserTask.ConfigureAwait(false); if (usersInstanceUser == default) - originalModel.InstanceUsers.Add(InstanceAdminUser()); + { + var instanceAdminUser = InstanceAdminUser(); + instanceAdminUser.InstanceId = originalModel.Id; + DatabaseContext.InstanceUsers.Add(instanceAdminUser); + } else usersInstanceUser.InstanceUserRights |= InstanceUserRights.WriteUsers; From 1f265d1505835fdf2bf5b79f5b332a88debe1a8b Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Fri, 28 Sep 2018 15:57:59 -0400 Subject: [PATCH 3/3] Add integration test for restoring lost instance user permissions --- tests/Tgstation.Server.Tests/InstanceManagerTest.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/Tgstation.Server.Tests/InstanceManagerTest.cs b/tests/Tgstation.Server.Tests/InstanceManagerTest.cs index 3464217fd6..0c9efe68b9 100644 --- a/tests/Tgstation.Server.Tests/InstanceManagerTest.cs +++ b/tests/Tgstation.Server.Tests/InstanceManagerTest.cs @@ -93,6 +93,19 @@ namespace Tgstation.Server.Tests var testSuite1 = new InstanceTest(instanceManagerClient.CreateClient(firstTest)); await testSuite1.RunTests(cancellationToken).ConfigureAwait(false); + //can regain permissions on instance without instance user + var instanceClient = instanceManagerClient.CreateClient(firstTest); + var ourInstanceUser = await instanceClient.Users.Read(cancellationToken).ConfigureAwait(false); + await instanceClient.Users.Delete(ourInstanceUser, cancellationToken).ConfigureAwait(false); + + await Assert.ThrowsExceptionAsync(() => instanceClient.Users.Read(cancellationToken)).ConfigureAwait(false); + + await instanceManagerClient.Update(new Api.Models.Instance + { + Id = firstTest.Id + }, cancellationToken).ConfigureAwait(false); + ourInstanceUser = await instanceClient.Users.Read(cancellationToken).ConfigureAwait(false); + //can't detach online instance await Assert.ThrowsExceptionAsync(() => instanceManagerClient.Detach(firstTest, cancellationToken)).ConfigureAwait(false);