2026-01-30 13:53:24 +01:00
|
|
|
|
using Bit.Core.Entities;
|
|
|
|
|
|
using Bit.RustSDK;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Bit.Seeder.Factories;
|
|
|
|
|
|
|
2026-01-30 16:03:56 +01:00
|
|
|
|
public class CollectionSeeder
|
2026-01-30 13:53:24 +01:00
|
|
|
|
{
|
2026-01-30 16:03:56 +01:00
|
|
|
|
public static Collection CreateCollection(Guid organizationId, string orgKey, string name)
|
2026-01-30 13:53:24 +01:00
|
|
|
|
{
|
|
|
|
|
|
return new Collection
|
|
|
|
|
|
{
|
|
|
|
|
|
Id = Guid.NewGuid(),
|
|
|
|
|
|
OrganizationId = organizationId,
|
2026-01-30 16:03:56 +01:00
|
|
|
|
Name = RustSdkService.EncryptString(name, orgKey),
|
2026-01-30 13:53:24 +01:00
|
|
|
|
CreationDate = DateTime.UtcNow,
|
|
|
|
|
|
RevisionDate = DateTime.UtcNow
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static CollectionUser CreateCollectionUser(
|
|
|
|
|
|
Guid collectionId,
|
|
|
|
|
|
Guid organizationUserId,
|
|
|
|
|
|
bool readOnly = false,
|
|
|
|
|
|
bool hidePasswords = false,
|
|
|
|
|
|
bool manage = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new CollectionUser
|
|
|
|
|
|
{
|
|
|
|
|
|
CollectionId = collectionId,
|
|
|
|
|
|
OrganizationUserId = organizationUserId,
|
|
|
|
|
|
ReadOnly = readOnly,
|
|
|
|
|
|
HidePasswords = hidePasswords,
|
|
|
|
|
|
Manage = manage
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|