mirror of
https://github.com/bitwarden/server
synced 2025-12-25 04:33:26 +00:00
* Add support CanReadSecret authorization * Extract base response model for secret * Add support for SA bulk fetching event logging * secret repository bug fix * Add endpoint and request for bulk fetching secrets * Swap to original reference event * Add unit tests * Add integration tests * Add unit tests for authz handler * update authz handler tests ---------
67 lines
1.6 KiB
C#
67 lines
1.6 KiB
C#
using Bit.Core.Models.Api;
|
|
using Bit.Core.SecretsManager.Entities;
|
|
|
|
namespace Bit.Api.SecretsManager.Models.Response;
|
|
|
|
public class BaseSecretResponseModel : ResponseModel
|
|
{
|
|
private const string _objectName = "baseSecret";
|
|
|
|
public BaseSecretResponseModel(Secret secret, string objectName = _objectName) : base(objectName)
|
|
{
|
|
if (secret == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(secret));
|
|
}
|
|
|
|
Id = secret.Id;
|
|
OrganizationId = secret.OrganizationId;
|
|
Key = secret.Key;
|
|
Value = secret.Value;
|
|
Note = secret.Note;
|
|
CreationDate = secret.CreationDate;
|
|
RevisionDate = secret.RevisionDate;
|
|
Projects = secret.Projects?.Select(p => new SecretResponseInnerProject(p));
|
|
}
|
|
|
|
public BaseSecretResponseModel(string objectName = _objectName) : base(objectName)
|
|
{
|
|
}
|
|
|
|
public BaseSecretResponseModel() : base(_objectName)
|
|
{
|
|
}
|
|
|
|
public Guid Id { get; set; }
|
|
|
|
public Guid OrganizationId { get; set; }
|
|
|
|
public string Key { get; set; }
|
|
|
|
public string Value { get; set; }
|
|
|
|
public string Note { get; set; }
|
|
|
|
public DateTime CreationDate { get; set; }
|
|
|
|
public DateTime RevisionDate { get; set; }
|
|
|
|
public IEnumerable<SecretResponseInnerProject> Projects { get; set; }
|
|
|
|
public class SecretResponseInnerProject
|
|
{
|
|
public SecretResponseInnerProject(Project project)
|
|
{
|
|
Id = project.Id;
|
|
Name = project.Name;
|
|
}
|
|
|
|
public SecretResponseInnerProject()
|
|
{
|
|
}
|
|
|
|
public Guid Id { get; set; }
|
|
public string Name { get; set; }
|
|
}
|
|
}
|