diff --git a/build/Version.props b/build/Version.props index 54cf30d7a6..1fb328a5a3 100644 --- a/build/Version.props +++ b/build/Version.props @@ -5,7 +5,7 @@ 4.4.0 2.0.0 7.0.0 - 7.3.0 + 8.0.0 5.2.2 0.4.0 1.1.0 diff --git a/src/Tgstation.Server.Api/Rights/ByondRights.cs b/src/Tgstation.Server.Api/Rights/ByondRights.cs index f6642164c7..96457c77da 100644 --- a/src/Tgstation.Server.Api/Rights/ByondRights.cs +++ b/src/Tgstation.Server.Api/Rights/ByondRights.cs @@ -24,13 +24,18 @@ namespace Tgstation.Server.Api.Rights ListInstalled = 2, /// - /// User may change the active BYOND version + /// User may change the active BYOND version. Also allows installing official BYOND versions /// - ChangeVersion = 4, + InstallOfficialOrChangeActiveVersion = 4, /// /// User may cancel version installations /// - CancelInstall = 8 + CancelInstall = 8, + + /// + /// User may upload custom BYOND versions + /// + InstallCustomVersion = 16, } } diff --git a/src/Tgstation.Server.Host/Controllers/ByondController.cs b/src/Tgstation.Server.Host/Controllers/ByondController.cs index 0e27ba918c..76efcd7689 100644 --- a/src/Tgstation.Server.Host/Controllers/ByondController.cs +++ b/src/Tgstation.Server.Host/Controllers/ByondController.cs @@ -98,7 +98,7 @@ namespace Tgstation.Server.Host.Controllers /// Switched active version successfully. /// Created to install and switch active version successfully. [HttpPost] - [TgsAuthorize(ByondRights.ChangeVersion)] + [TgsAuthorize(ByondRights.InstallOfficialOrChangeActiveVersion | ByondRights.InstallCustomVersion)] [ProducesResponseType(typeof(Api.Models.Byond), 200)] [ProducesResponseType(typeof(Api.Models.Byond), 202)] public async Task Update([FromBody] Api.Models.Byond model, CancellationToken cancellationToken) @@ -111,6 +111,11 @@ namespace Tgstation.Server.Host.Controllers || (model.Content != null && model.Version.Build > 0)) return BadRequest(new ErrorMessage(ErrorCode.ModelValidationFailure)); + var userByondRights = AuthenticationContext.InstanceUser.ByondRights.Value; + if ((!userByondRights.HasFlag(ByondRights.InstallOfficialOrChangeActiveVersion) && model.Content == null) + || (!userByondRights.HasFlag(ByondRights.InstallCustomVersion) && model.Content != null)) + return Forbid(); + var byondManager = instanceManager.GetInstance(Instance).ByondManager; // remove cruff fields