mirror of
https://github.com/bitwarden/server
synced 2025-12-11 05:43:35 +00:00
fix(grantor-policies): [PM-21921] add null check (#5886)
When getting grantor policies, adds a null check so that: - For a Grantor who is an org Owner, we respond with a `200` and the policies - For a Grantor is not an org Owner, we respond with a `200` and `null`
This commit is contained in:
@@ -4,7 +4,6 @@ using Bit.Api.Auth.Models.Request;
|
||||
using Bit.Api.Auth.Models.Response;
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Api.Vault.Models.Response;
|
||||
using Bit.Core.AdminConsole.Entities;
|
||||
using Bit.Core.Auth.Services;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Repositories;
|
||||
@@ -72,7 +71,7 @@ public class EmergencyAccessController : Controller
|
||||
{
|
||||
var user = await _userService.GetUserByPrincipalAsync(User);
|
||||
var policies = await _emergencyAccessService.GetPoliciesAsync(id, user);
|
||||
var responses = policies.Select<Policy, PolicyResponseModel>(policy => new PolicyResponseModel(policy));
|
||||
var responses = policies?.Select(policy => new PolicyResponseModel(policy));
|
||||
return new ListResponseModel<PolicyResponseModel>(responses);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user