From dc4ea3d599d2c8b2a9c6c6cfccd5f3c335876f03 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Fri, 10 Aug 2018 14:26:22 -0400 Subject: [PATCH] A note about unsetting access credentials --- docs/API.dox | 10 ++++++++++ .../Controllers/RepositoryController.cs | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/API.dox b/docs/API.dox index f06d754d2e..0c329f2a8e 100644 --- a/docs/API.dox +++ b/docs/API.dox @@ -327,7 +327,17 @@ Any of the above POST methods can be combined with the @ref Tgstation.Server.Api If the server detects a set of @ref Tgstation.Server.Api.Models.TestMergeParameters being applied that it has seen before, it'll instead attempt to checkout the commit that was created then. +@subsubsection api_repounsetauth Unsetting Authentication +The repository uses the @ref Tgstation.Server.Api.Models.Repository.AccessUser and @ref Tgstation.Server.Api.Models.Repository.AccessToken credentials to access the remote repository if these fields are set. To unset them you must set both of them to an empty string like so +@code{.json} +{ + "accessUser": "", + "accessToken": "" +} +@endcode + +This will remove both fields from the database */ diff --git a/src/Tgstation.Server.Host/Controllers/RepositoryController.cs b/src/Tgstation.Server.Host/Controllers/RepositoryController.cs index 50bcc733a6..b170498ca5 100644 --- a/src/Tgstation.Server.Host/Controllers/RepositoryController.cs +++ b/src/Tgstation.Server.Host/Controllers/RepositoryController.cs @@ -282,7 +282,7 @@ namespace Tgstation.Server.Host.Controllers || (model.UpdateFromOrigin == true && !userRights.HasFlag(RepositoryRights.UpdateBranch))) return Forbid(); - if (currentModel.AccessToken.Length == 0 || currentModel.AccessUser.Length == 0) + if (currentModel.AccessToken.Length == 0 && currentModel.AccessUser.Length == 0) { //setting an empty string clears everything currentModel.AccessUser = null;