1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-05 10:02:47 -05:00

org totp and storage flags

This commit is contained in:
Kyle Spearrin
2017-07-07 14:08:30 -04:00
parent 43262e577c
commit fbc189544b
20 changed files with 97 additions and 17 deletions

View File

@ -48,11 +48,13 @@ namespace Bit.Core.Models.Api
FolderId = cipher.FolderId?.ToString();
Favorite = cipher.Favorite;
Edit = cipher.Edit;
OrganizationUseTotp = cipher.OrganizationUseTotp;
}
public string FolderId { get; set; }
public bool Favorite { get; set; }
public bool Edit { get; set; }
public bool OrganizationUseTotp { get; set; }
}
public class CipherDetailsResponseModel : CipherResponseModel

View File

@ -7,7 +7,7 @@ namespace Bit.Core.Models.Api
{
public class LoginResponseModel : ResponseModel
{
public LoginResponseModel(Cipher cipher, GlobalSettings globalSettings, string obj = "login")
public LoginResponseModel(Cipher cipher, GlobalSettings globalSettings, bool orgUseTotp, string obj = "login")
: base(obj)
{
if(cipher == null)
@ -32,11 +32,12 @@ namespace Bit.Core.Models.Api
Totp = data.Totp;
RevisionDate = cipher.RevisionDate;
Edit = true;
OrganizationUseTotp = orgUseTotp;
Attachments = AttachmentResponseModel.FromCipher(cipher, globalSettings);
}
public LoginResponseModel(CipherDetails cipher, GlobalSettings globalSettings, string obj = "login")
: this(cipher as Cipher, globalSettings, obj)
: this(cipher as Cipher, globalSettings, cipher.OrganizationUseTotp, obj)
{
FolderId = cipher.FolderId?.ToString();
Favorite = cipher.Favorite;
@ -48,6 +49,7 @@ namespace Bit.Core.Models.Api
public string FolderId { get; set; }
public bool Favorite { get; set; }
public bool Edit { get; set; }
public bool OrganizationUseTotp { get; set; }
public string Name { get; set; }
public string Uri { get; set; }
public string Username { get; set; }

View File

@ -12,8 +12,10 @@ namespace Bit.Core.Models.Api
Name = organization.Name;
UseGroups = organization.UseGroups;
UseDirectory = organization.UseDirectory;
UseTotp = organization.UseTotp;
Seats = organization.Seats;
MaxCollections = organization.MaxCollections;
MaxStorageGb = organization.MaxStorageGb;
Key = organization.Key;
Status = organization.Status;
Type = organization.Type;
@ -24,8 +26,10 @@ namespace Bit.Core.Models.Api
public string Name { get; set; }
public bool UseGroups { get; set; }
public bool UseDirectory { get; set; }
public bool UseTotp { get; set; }
public int Seats { get; set; }
public int MaxCollections { get; set; }
public short? MaxStorageGb { get; set; }
public string Key { get; set; }
public OrganizationUserStatusType Status { get; set; }
public OrganizationUserType Type { get; set; }

View File

@ -8,5 +8,6 @@ namespace Core.Models.Data
public Guid? FolderId { get; set; }
public bool Favorite { get; set; }
public bool Edit { get; set; }
public bool OrganizationUseTotp { get; set; }
}
}

View File

@ -9,8 +9,10 @@ namespace Bit.Core.Models.Data
public string Name { get; set; }
public bool UseGroups { get; set; }
public bool UseDirectory { get; set; }
public bool UseTotp { get; set; }
public int Seats { get; set; }
public int MaxCollections { get; set; }
public short? MaxStorageGb { get; set; }
public string Key { get; set; }
public Enums.OrganizationUserStatusType Status { get; set; }
public Enums.OrganizationUserType Type { get; set; }

View File

@ -13,6 +13,8 @@ namespace Bit.Core.Models.StaticStore
public short? MaxAdditionalSeats { get; set; }
public bool UseGroups { get; set; }
public bool UseDirectory { get; set; }
public bool UseTotp { get; set; }
public short? MaxStorageGb { get; set; }
public decimal BasePrice { get; set; }
public decimal SeatPrice { get; set; }
public short? MaxCollections { get; set; }

View File

@ -16,6 +16,7 @@ namespace Bit.Core.Models.Table
public short? MaxCollections { get; set; }
public bool UseGroups { get; set; }
public bool UseDirectory { get; set; }
public bool UseTotp { get; set; }
public long? Storage { get; set; }
public short? MaxStorageGb { get; set; }
public string StripeCustomerId { get; set; }

View File

@ -79,6 +79,12 @@ namespace Bit.Core.Services
{
await _cipherRepository.CreateAsync(cipher);
if(cipher.OrganizationId.HasValue)
{
var org = await _organizationRepository.GetByIdAsync(cipher.OrganizationId.Value);
cipher.OrganizationUseTotp = org.UseTotp;
}
// push
await _pushService.PushSyncCipherCreateAsync(cipher);
}

View File

@ -423,8 +423,10 @@ namespace Bit.Core.Services
PlanType = plan.Type,
Seats = (short)(plan.BaseSeats + signup.AdditionalSeats),
MaxCollections = plan.MaxCollections,
MaxStorageGb = plan.MaxStorageGb,
UseGroups = plan.UseGroups,
UseDirectory = plan.UseDirectory,
UseTotp = plan.UseTotp,
Plan = plan.Name,
StripeCustomerId = customer?.Id,
StripeSubscriptionId = subscription?.Id,

View File

@ -1,6 +1,5 @@
using Bit.Core.Enums;
using Bit.Core.Models.StaticStore;
using System;
using System.Collections.Generic;
namespace Bit.Core.Utilities
@ -112,7 +111,9 @@ namespace Bit.Core.Utilities
StripePlanId = "personal-org-annually",
StripeSeatPlanId = "personal-org-seat-annually",
UpgradeSortOrder = 1,
TrialPeriodDays = 7
TrialPeriodDays = 7,
UseTotp = true,
MaxStorageGb = 1
},
new Plan
{
@ -125,7 +126,9 @@ namespace Bit.Core.Utilities
StripePlanId = "teams-org-monthly",
StripeSeatPlanId = "teams-org-seat-monthly",
UpgradeSortOrder = 2,
TrialPeriodDays = 7
TrialPeriodDays = 7,
UseTotp = true,
MaxStorageGb = 1
},
new Plan
{
@ -138,7 +141,9 @@ namespace Bit.Core.Utilities
StripePlanId = "teams-org-annually",
StripeSeatPlanId = "teams-org-seat-annually",
UpgradeSortOrder = 2,
TrialPeriodDays = 7
TrialPeriodDays = 7,
UseTotp = true,
MaxStorageGb = 1
},
new Plan
{
@ -153,7 +158,9 @@ namespace Bit.Core.Utilities
UpgradeSortOrder = 3,
TrialPeriodDays = 7,
UseGroups = true,
UseDirectory = true
UseDirectory = true,
UseTotp = true,
MaxStorageGb = 1
},
new Plan
{
@ -168,7 +175,9 @@ namespace Bit.Core.Utilities
UpgradeSortOrder = 3,
TrialPeriodDays = 7,
UseGroups = true,
UseDirectory = true
UseDirectory = true,
UseTotp = true,
MaxStorageGb = 1
}
};