1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 17:12:49 -05:00

renaming subvault => collection

This commit is contained in:
Kyle Spearrin
2017-04-27 09:19:30 -04:00
parent 2340369d56
commit c6ac82dadd
87 changed files with 493 additions and 493 deletions

View File

@ -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; }
}
}

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

View File

@ -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; }