mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
renaming subvault => collection
This commit is contained in:
@ -64,7 +64,7 @@ namespace Bit.Core.Models.Api
|
||||
public class CipherShareRequestModel : IValidatableObject
|
||||
{
|
||||
[Required]
|
||||
public IEnumerable<string> SubvaultIds { get; set; }
|
||||
public IEnumerable<string> CollectionIds { get; set; }
|
||||
[Required]
|
||||
public CipherRequestModel Cipher { get; set; }
|
||||
|
||||
@ -76,17 +76,17 @@ namespace Bit.Core.Models.Api
|
||||
new string[] { nameof(Cipher.OrganizationId) });
|
||||
}
|
||||
|
||||
if(!SubvaultIds?.Any() ?? false)
|
||||
if(!CollectionIds?.Any() ?? false)
|
||||
{
|
||||
yield return new ValidationResult("You must select at least one subvault.",
|
||||
new string[] { nameof(SubvaultIds) });
|
||||
yield return new ValidationResult("You must select at least one collection.",
|
||||
new string[] { nameof(CollectionIds) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CipherSubvaultsRequestModel
|
||||
public class CipherCollectionsRequestModel
|
||||
{
|
||||
[Required]
|
||||
public IEnumerable<string> SubvaultIds { get; set; }
|
||||
public IEnumerable<string> CollectionIds { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ namespace Bit.Core.Models.Api
|
||||
public string Email { get; set; }
|
||||
[Required]
|
||||
public Enums.OrganizationUserType? Type { get; set; }
|
||||
public bool AccessAllSubvaults { get; set; }
|
||||
public IEnumerable<OrganizationUserSubvaultRequestModel> Subvaults { get; set; }
|
||||
public bool AccessAllCollections { get; set; }
|
||||
public IEnumerable<OrganizationUserCollectionRequestModel> Collections { get; set; }
|
||||
}
|
||||
|
||||
public class OrganizationUserAcceptRequestModel
|
||||
@ -32,32 +32,32 @@ namespace Bit.Core.Models.Api
|
||||
{
|
||||
[Required]
|
||||
public Enums.OrganizationUserType? Type { get; set; }
|
||||
public bool AccessAllSubvaults { get; set; }
|
||||
public IEnumerable<OrganizationUserSubvaultRequestModel> Subvaults { get; set; }
|
||||
public bool AccessAllCollections { get; set; }
|
||||
public IEnumerable<OrganizationUserCollectionRequestModel> Collections { get; set; }
|
||||
|
||||
public OrganizationUser ToOrganizationUser(OrganizationUser existingUser)
|
||||
{
|
||||
existingUser.Type = Type.Value;
|
||||
existingUser.AccessAllSubvaults = AccessAllSubvaults;
|
||||
existingUser.AccessAllCollections = AccessAllCollections;
|
||||
return existingUser;
|
||||
}
|
||||
}
|
||||
|
||||
public class OrganizationUserSubvaultRequestModel
|
||||
public class OrganizationUserCollectionRequestModel
|
||||
{
|
||||
[Required]
|
||||
public string SubvaultId { get; set; }
|
||||
public string CollectionId { get; set; }
|
||||
public bool ReadOnly { get; set; }
|
||||
|
||||
public SubvaultUser ToSubvaultUser()
|
||||
public CollectionUser ToCollectionUser()
|
||||
{
|
||||
var subvault = new SubvaultUser
|
||||
var collection = new CollectionUser
|
||||
{
|
||||
ReadOnly = ReadOnly,
|
||||
SubvaultId = new Guid(SubvaultId)
|
||||
CollectionId = new Guid(CollectionId)
|
||||
};
|
||||
|
||||
return subvault;
|
||||
return collection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,25 +6,25 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class SubvaultRequestModel
|
||||
public class CollectionRequestModel
|
||||
{
|
||||
[Required]
|
||||
[EncryptedString]
|
||||
[StringLength(300)]
|
||||
public string Name { get; set; }
|
||||
|
||||
public Subvault ToSubvault(Guid orgId)
|
||||
public Collection ToCollection(Guid orgId)
|
||||
{
|
||||
return ToSubvault(new Subvault
|
||||
return ToCollection(new Collection
|
||||
{
|
||||
OrganizationId = orgId
|
||||
});
|
||||
}
|
||||
|
||||
public Subvault ToSubvault(Subvault existingSubvault)
|
||||
public Collection ToCollection(Collection existingCollection)
|
||||
{
|
||||
existingSubvault.Name = Name;
|
||||
return existingSubvault;
|
||||
existingCollection.Name = Name;
|
||||
return existingCollection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,29 +5,29 @@ using System.Linq;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class SubvaultUserSubvaultRequestModel
|
||||
public class CollectionUserCollectionRequestModel
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
public IEnumerable<Subvault> Subvaults { get; set; }
|
||||
public IEnumerable<Collection> Collections { get; set; }
|
||||
|
||||
public IEnumerable<SubvaultUser> ToSubvaultUsers()
|
||||
public IEnumerable<CollectionUser> ToCollectionUsers()
|
||||
{
|
||||
return Subvaults.Select(s => new SubvaultUser
|
||||
return Collections.Select(s => new CollectionUser
|
||||
{
|
||||
OrganizationUserId = new Guid(UserId),
|
||||
SubvaultId = new Guid(s.SubvaultId),
|
||||
CollectionId = new Guid(s.CollectionId),
|
||||
ReadOnly = s.ReadOnly
|
||||
});
|
||||
}
|
||||
|
||||
public class Subvault
|
||||
public class Collection
|
||||
{
|
||||
public string SubvaultId { get; set; }
|
||||
public string CollectionId { get; set; }
|
||||
public bool ReadOnly { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class SubvaultUserUserRequestModel
|
||||
public class CollectionUserUserRequestModel
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
public bool ReadOnly { get; set; }
|
||||
|
@ -74,52 +74,52 @@ namespace Bit.Core.Models.Api
|
||||
public class CipherDetailsResponseModel : CipherResponseModel
|
||||
{
|
||||
public CipherDetailsResponseModel(CipherDetails cipher,
|
||||
IDictionary<Guid, IGrouping<Guid, SubvaultCipher>> subvaultCiphers, string obj = "cipherDetails")
|
||||
IDictionary<Guid, IGrouping<Guid, CollectionCipher>> collectionCiphers, string obj = "cipherDetails")
|
||||
: base(cipher, obj)
|
||||
{
|
||||
if(subvaultCiphers.ContainsKey(cipher.Id))
|
||||
if(collectionCiphers.ContainsKey(cipher.Id))
|
||||
{
|
||||
SubvaultIds = subvaultCiphers[cipher.Id].Select(s => s.SubvaultId);
|
||||
CollectionIds = collectionCiphers[cipher.Id].Select(s => s.CollectionId);
|
||||
}
|
||||
else
|
||||
{
|
||||
SubvaultIds = new Guid[] { };
|
||||
CollectionIds = new Guid[] { };
|
||||
}
|
||||
}
|
||||
|
||||
public CipherDetailsResponseModel(CipherDetails cipher, IEnumerable<SubvaultCipher> subvaultCiphers,
|
||||
public CipherDetailsResponseModel(CipherDetails cipher, IEnumerable<CollectionCipher> collectionCiphers,
|
||||
string obj = "cipherDetails")
|
||||
: base(cipher, obj)
|
||||
{
|
||||
SubvaultIds = subvaultCiphers.Select(s => s.SubvaultId);
|
||||
CollectionIds = collectionCiphers.Select(s => s.CollectionId);
|
||||
}
|
||||
|
||||
public IEnumerable<Guid> SubvaultIds { get; set; }
|
||||
public IEnumerable<Guid> CollectionIds { get; set; }
|
||||
}
|
||||
|
||||
public class CipherMiniDetailsResponseModel : CipherMiniResponseModel
|
||||
{
|
||||
public CipherMiniDetailsResponseModel(Cipher cipher,
|
||||
IDictionary<Guid, IGrouping<Guid, SubvaultCipher>> subvaultCiphers, string obj = "cipherMiniDetails")
|
||||
IDictionary<Guid, IGrouping<Guid, CollectionCipher>> collectionCiphers, string obj = "cipherMiniDetails")
|
||||
: base(cipher, obj)
|
||||
{
|
||||
if(subvaultCiphers.ContainsKey(cipher.Id))
|
||||
if(collectionCiphers.ContainsKey(cipher.Id))
|
||||
{
|
||||
SubvaultIds = subvaultCiphers[cipher.Id].Select(s => s.SubvaultId);
|
||||
CollectionIds = collectionCiphers[cipher.Id].Select(s => s.CollectionId);
|
||||
}
|
||||
else
|
||||
{
|
||||
SubvaultIds = new Guid[] { };
|
||||
CollectionIds = new Guid[] { };
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Guid> SubvaultIds { get; set; }
|
||||
public IEnumerable<Guid> CollectionIds { get; set; }
|
||||
}
|
||||
|
||||
public class CipherFullDetailsResponseModel : CipherDetailsResponseModel
|
||||
{
|
||||
public CipherFullDetailsResponseModel(CipherFullDetails cipher, IEnumerable<SubvaultCipher> subvaultCiphers)
|
||||
: base(cipher, subvaultCiphers, "cipherFullDetails")
|
||||
public CipherFullDetailsResponseModel(CipherFullDetails cipher, IEnumerable<CollectionCipher> collectionCiphers)
|
||||
: base(cipher, collectionCiphers, "cipherFullDetails")
|
||||
{
|
||||
Edit = cipher.Edit;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace Bit.Core.Models.Api
|
||||
Email = organizationUser.Email;
|
||||
Type = organizationUser.Type;
|
||||
Status = organizationUser.Status;
|
||||
AccessAllSubvaults = organizationUser.AccessAllSubvaults;
|
||||
AccessAllCollections = organizationUser.AccessAllCollections;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
@ -31,19 +31,19 @@ namespace Bit.Core.Models.Api
|
||||
public string Email { get; set; }
|
||||
public OrganizationUserType Type { get; set; }
|
||||
public OrganizationUserStatusType Status { get; set; }
|
||||
public bool AccessAllSubvaults { get; set; }
|
||||
public bool AccessAllCollections { get; set; }
|
||||
}
|
||||
|
||||
public class OrganizationUserDetailsResponseModel : OrganizationUserResponseModel
|
||||
{
|
||||
public OrganizationUserDetailsResponseModel(OrganizationUserUserDetails organizationUser,
|
||||
IEnumerable<SubvaultUserSubvaultDetails> subvaults)
|
||||
IEnumerable<CollectionUserCollectionDetails> collections)
|
||||
: base(organizationUser, "organizationUserDetails")
|
||||
{
|
||||
Subvaults = new ListResponseModel<OrganizationUserSubvaultResponseModel>(
|
||||
subvaults.Select(s => new OrganizationUserSubvaultResponseModel(s)));
|
||||
Collections = new ListResponseModel<OrganizationUserCollectionResponseModel>(
|
||||
collections.Select(s => new OrganizationUserCollectionResponseModel(s)));
|
||||
}
|
||||
|
||||
public ListResponseModel<OrganizationUserSubvaultResponseModel> Subvaults { get; set; }
|
||||
public ListResponseModel<OrganizationUserCollectionResponseModel> Collections { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ using Bit.Core.Models.Data;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class OrganizationUserSubvaultResponseModel : ResponseModel
|
||||
public class OrganizationUserCollectionResponseModel : ResponseModel
|
||||
{
|
||||
public OrganizationUserSubvaultResponseModel(SubvaultUserSubvaultDetails details,
|
||||
string obj = "organizationUserSubvault")
|
||||
public OrganizationUserCollectionResponseModel(CollectionUserCollectionDetails details,
|
||||
string obj = "organizationUserCollection")
|
||||
: base(obj)
|
||||
{
|
||||
if(details == null)
|
||||
@ -16,13 +16,13 @@ namespace Bit.Core.Models.Api
|
||||
|
||||
Id = details.Id.ToString();
|
||||
Name = details.Name;
|
||||
SubvaultId = details.SubvaultId.ToString();
|
||||
CollectionId = details.CollectionId.ToString();
|
||||
ReadOnly = details.ReadOnly;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string SubvaultId { get; set; }
|
||||
public string CollectionId { get; set; }
|
||||
public bool ReadOnly { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -3,19 +3,19 @@ using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class SubvaultResponseModel : ResponseModel
|
||||
public class CollectionResponseModel : ResponseModel
|
||||
{
|
||||
public SubvaultResponseModel(Subvault subvault)
|
||||
: base("subvault")
|
||||
public CollectionResponseModel(Collection collection)
|
||||
: base("collection")
|
||||
{
|
||||
if(subvault == null)
|
||||
if(collection == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(subvault));
|
||||
throw new ArgumentNullException(nameof(collection));
|
||||
}
|
||||
|
||||
Id = subvault.Id.ToString();
|
||||
OrganizationId = subvault.OrganizationId.ToString();
|
||||
Name = subvault.Name;
|
||||
Id = collection.Id.ToString();
|
||||
OrganizationId = collection.OrganizationId.ToString();
|
||||
Name = collection.Name;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
|
@ -5,31 +5,31 @@ using Bit.Core.Enums;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class SubvaultUserResponseModel : ResponseModel
|
||||
public class CollectionUserResponseModel : ResponseModel
|
||||
{
|
||||
public SubvaultUserResponseModel(SubvaultUserUserDetails subvaultUser)
|
||||
: base("subvaultUser")
|
||||
public CollectionUserResponseModel(CollectionUserUserDetails collectionUser)
|
||||
: base("collectionUser")
|
||||
{
|
||||
if(subvaultUser == null)
|
||||
if(collectionUser == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(subvaultUser));
|
||||
throw new ArgumentNullException(nameof(collectionUser));
|
||||
}
|
||||
|
||||
Id = subvaultUser.Id?.ToString();
|
||||
OrganizationUserId = subvaultUser.OrganizationUserId.ToString();
|
||||
SubvaultId = subvaultUser.SubvaultId?.ToString();
|
||||
AccessAllSubvaults = subvaultUser.AccessAllSubvaults;
|
||||
Name = subvaultUser.Name;
|
||||
Email = subvaultUser.Email;
|
||||
Type = subvaultUser.Type;
|
||||
Status = subvaultUser.Status;
|
||||
ReadOnly = subvaultUser.ReadOnly;
|
||||
Id = collectionUser.Id?.ToString();
|
||||
OrganizationUserId = collectionUser.OrganizationUserId.ToString();
|
||||
CollectionId = collectionUser.CollectionId?.ToString();
|
||||
AccessAllCollections = collectionUser.AccessAllCollections;
|
||||
Name = collectionUser.Name;
|
||||
Email = collectionUser.Email;
|
||||
Type = collectionUser.Type;
|
||||
Status = collectionUser.Status;
|
||||
ReadOnly = collectionUser.ReadOnly;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string OrganizationUserId { get; set; }
|
||||
public string SubvaultId { get; set; }
|
||||
public bool AccessAllSubvaults { get; set; }
|
||||
public string CollectionId { get; set; }
|
||||
public bool AccessAllCollections { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Email { get; set; }
|
||||
public OrganizationUserType Type { get; set; }
|
||||
|
@ -11,6 +11,6 @@ namespace Bit.Core.Models.Data
|
||||
public string Email { get; set; }
|
||||
public Enums.OrganizationUserStatusType Status { get; set; }
|
||||
public Enums.OrganizationUserType Type { get; set; }
|
||||
public bool AccessAllSubvaults { get; set; }
|
||||
public bool AccessAllCollections { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
public class SubvaultUserSubvaultDetails
|
||||
public class CollectionUserCollectionDetails
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid OrganizationUserId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public Guid SubvaultId { get; set; }
|
||||
public Guid CollectionId { get; set; }
|
||||
public bool ReadOnly { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
public class SubvaultUserUserDetails
|
||||
public class CollectionUserUserDetails
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public Guid OrganizationUserId { get; set; }
|
||||
public Guid? SubvaultId { get; set; }
|
||||
public bool AccessAllSubvaults { get; set; }
|
||||
public Guid? CollectionId { get; set; }
|
||||
public bool AccessAllCollections { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Email { get; set; }
|
||||
public Enums.OrganizationUserStatusType Status { get; set; }
|
||||
|
@ -13,7 +13,7 @@ namespace Bit.Core.Models.StaticStore
|
||||
public short? MaxAdditionalSeats { get; set; }
|
||||
public decimal BasePrice { get; set; }
|
||||
public decimal SeatPrice { get; set; }
|
||||
public short? MaxSubvaults { get; set; }
|
||||
public short? MaxCollections { get; set; }
|
||||
public int UpgradeSortOrder { get; set; }
|
||||
public bool Disabled { get; set; }
|
||||
public int? TrialPeriodDays { get; set; }
|
||||
|
@ -13,7 +13,7 @@ namespace Bit.Core.Models.Table
|
||||
public string Plan { get; set; }
|
||||
public PlanType PlanType { get; set; }
|
||||
public short? Seats { get; set; }
|
||||
public short? MaxSubvaults { get; set; }
|
||||
public short? MaxCollections { get; set; }
|
||||
public string StripeCustomerId { get; set; }
|
||||
public string StripeSubscriptionId { get; set; }
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
@ -13,7 +13,7 @@ namespace Bit.Core.Models.Table
|
||||
public string Key { get; set; }
|
||||
public OrganizationUserStatusType Status { get; set; }
|
||||
public OrganizationUserType Type { get; set; }
|
||||
public bool AccessAllSubvaults { get; set; }
|
||||
public bool AccessAllCollections { get; set; }
|
||||
public DateTime CreationDate { get; internal set; } = DateTime.UtcNow;
|
||||
public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow;
|
||||
|
||||
|
@ -3,7 +3,7 @@ using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Table
|
||||
{
|
||||
public class Subvault : IDataObject<Guid>
|
||||
public class Collection : IDataObject<Guid>
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid OrganizationId { get; set; }
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Bit.Core.Models.Table
|
||||
{
|
||||
public class SubvaultCipher
|
||||
public class CollectionCipher
|
||||
{
|
||||
public Guid SubvaultId { get; set; }
|
||||
public Guid CollectionId { get; set; }
|
||||
public Guid CipherId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Table
|
||||
{
|
||||
public class SubvaultUser : IDataObject<Guid>
|
||||
public class CollectionUser : IDataObject<Guid>
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid SubvaultId { get; set; }
|
||||
public Guid CollectionId { get; set; }
|
||||
public Guid OrganizationUserId { get; set; }
|
||||
public bool ReadOnly { get; set; }
|
||||
public DateTime CreationDate { get; internal set; } = DateTime.UtcNow;
|
||||
|
Reference in New Issue
Block a user