mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
GreenField: Switch to Blob for API Keys
This commit is contained in:
@@ -50,7 +50,10 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
UserId = _userManager.GetUserId(User),
|
||||
Label = request.Label
|
||||
};
|
||||
key.Permissions = string.Join(";", request.Permissions.Select(p => p.ToString()).Distinct().ToArray());
|
||||
key.SetBlob(new APIKeyBlob()
|
||||
{
|
||||
Permissions = request.Permissions.Select(p => p.ToString()).Distinct().ToArray()
|
||||
});
|
||||
await _apiKeyRepository.CreateKey(key);
|
||||
return Ok(FromModel(key));
|
||||
}
|
||||
@@ -82,7 +85,7 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
{
|
||||
return new ApiKeyData()
|
||||
{
|
||||
Permissions = Permission.ToPermissions(data.Permissions).ToArray(),
|
||||
Permissions = Permission.ToPermissions(data.GetBlob().Permissions).ToArray(),
|
||||
ApiKey = data.Id,
|
||||
Label = data.Label ?? string.Empty
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user