mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
collection externalId
This commit is contained in:
14
src/Core/Models/Api/Public/CollectionBaseModel.cs
Normal file
14
src/Core/Models/Api/Public/CollectionBaseModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
{
|
||||
public abstract class CollectionBaseModel
|
||||
{
|
||||
/// <summary>
|
||||
/// External identifier for reference or linking this collection to another system.
|
||||
/// </summary>
|
||||
/// <example>external_id_123456</example>
|
||||
[StringLength(300)]
|
||||
public string ExternalId { get; set; }
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ namespace Bit.Core.Models.Api.Public
|
||||
[Required]
|
||||
public bool? AccessAll { get; set; }
|
||||
/// <summary>
|
||||
/// External identifier linking this group to another system, such as a user directory.
|
||||
/// External identifier for reference or linking this group to another system, such as a user directory.
|
||||
/// </summary>
|
||||
/// <example>external_id_123456</example>
|
||||
[StringLength(300)]
|
||||
|
@ -46,7 +46,7 @@ namespace Bit.Core.Models.Api.Public
|
||||
[Required]
|
||||
public bool? AccessAll { get; set; }
|
||||
/// <summary>
|
||||
/// External identifier linking this member to another system, such as a user directory.
|
||||
/// External identifier for reference or linking this member to another system, such as a user directory.
|
||||
/// </summary>
|
||||
/// <example>external_id_123456</example>
|
||||
[StringLength(300)]
|
||||
|
@ -3,7 +3,7 @@ using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
{
|
||||
public class CollectionUpdateRequestModel
|
||||
public class CollectionUpdateRequestModel : CollectionBaseModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The associated groups that this collection is assigned to.
|
||||
@ -12,8 +12,7 @@ namespace Bit.Core.Models.Api.Public
|
||||
|
||||
public Collection ToCollection(Collection existingCollection)
|
||||
{
|
||||
// TODO
|
||||
// existingCollection.ExternalId = ExternalId;
|
||||
existingCollection.ExternalId = ExternalId;
|
||||
return existingCollection;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace Bit.Core.Models.Api.Public
|
||||
/// <summary>
|
||||
/// A collection.
|
||||
/// </summary>
|
||||
public class CollectionResponseModel : IResponseModel
|
||||
public class CollectionResponseModel : CollectionBaseModel, IResponseModel
|
||||
{
|
||||
public CollectionResponseModel(Collection collection, IEnumerable<SelectionReadOnly> groups)
|
||||
{
|
||||
@ -20,7 +20,7 @@ namespace Bit.Core.Models.Api.Public
|
||||
}
|
||||
|
||||
Id = collection.Id;
|
||||
// ExternalId = group.ExternalId; TODO: Add external is for referencing purposes
|
||||
ExternalId = collection.ExternalId;
|
||||
Groups = groups?.Select(c => new AssociationWithPermissionsResponseModel(c));
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@ namespace Bit.Core.Models.Api
|
||||
[EncryptedString]
|
||||
[EncryptedStringLength(1000)]
|
||||
public string Name { get; set; }
|
||||
[StringLength(300)]
|
||||
public string ExternalId { get; set; }
|
||||
public IEnumerable<SelectionReadOnlyRequestModel> Groups { get; set; }
|
||||
|
||||
public Collection ToCollection(Guid orgId)
|
||||
@ -26,6 +28,7 @@ namespace Bit.Core.Models.Api
|
||||
public Collection ToCollection(Collection existingCollection)
|
||||
{
|
||||
existingCollection.Name = Name;
|
||||
existingCollection.ExternalId = ExternalId;
|
||||
return existingCollection;
|
||||
}
|
||||
}
|
||||
|
@ -19,11 +19,13 @@ namespace Bit.Core.Models.Api
|
||||
Id = collection.Id.ToString();
|
||||
OrganizationId = collection.OrganizationId.ToString();
|
||||
Name = collection.Name;
|
||||
ExternalId = collection.ExternalId;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string OrganizationId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ExternalId { get; set; }
|
||||
}
|
||||
|
||||
public class CollectionDetailsResponseModel : CollectionResponseModel
|
||||
|
@ -8,6 +8,7 @@ namespace Bit.Core.Models.Table
|
||||
public Guid Id { get; set; }
|
||||
public Guid OrganizationId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ExternalId { get; set; }
|
||||
public DateTime CreationDate { get; internal set; } = DateTime.UtcNow;
|
||||
public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow;
|
||||
|
||||
|
Reference in New Issue
Block a user