From c2a4bc2603114e0ccbb47856039beda38f21a926 Mon Sep 17 00:00:00 2001 From: Kukks Date: Thu, 16 Jul 2020 10:26:04 +0200 Subject: [PATCH] GreenField: Remove requirement for permissions >= 1 when creating key Sometimes you just want to have an api key to verify a user still exists periodically on a server and do not need any permissions --- BTCPayServer/Controllers/GreenField/ApiKeysController.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/BTCPayServer/Controllers/GreenField/ApiKeysController.cs b/BTCPayServer/Controllers/GreenField/ApiKeysController.cs index b739ae3f0..6b95460d4 100644 --- a/BTCPayServer/Controllers/GreenField/ApiKeysController.cs +++ b/BTCPayServer/Controllers/GreenField/ApiKeysController.cs @@ -45,11 +45,7 @@ namespace BTCPayServer.Controllers.GreenField { if (request is null) return NotFound(); - if (request.Permissions is null || request.Permissions.Length == 0) - { - ModelState.AddModelError(nameof(request.Permissions), "One or more permissions are required"); - return this.CreateValidationError(ModelState); - } + request.Permissions ??= System.Array.Empty(); var key = new APIKeyData() { Id = Encoders.Hex.EncodeData(RandomUtils.GetBytes(20)),