1
0
mirror of https://github.com/bitwarden/server synced 2025-12-17 16:53:23 +00:00

Revert filescoped (#2227)

* Revert "Add git blame entry (#2226)"

This reverts commit 239286737d.

* Revert "Turn on file scoped namespaces (#2225)"

This reverts commit 34fb4cca2a.
This commit is contained in:
Justin Baur
2022-08-29 15:53:48 -04:00
committed by GitHub
parent 239286737d
commit bae03feffe
1208 changed files with 74317 additions and 73126 deletions

View File

@@ -5,138 +5,139 @@ using Bit.Core.Models.Data;
using Bit.Core.Models.Data.Organizations.OrganizationUsers;
using Bit.Core.Utilities;
namespace Bit.Api.Models.Response.Organizations;
public class OrganizationUserResponseModel : ResponseModel
namespace Bit.Api.Models.Response.Organizations
{
public OrganizationUserResponseModel(OrganizationUser organizationUser, string obj = "organizationUser")
: base(obj)
public class OrganizationUserResponseModel : ResponseModel
{
if (organizationUser == null)
public OrganizationUserResponseModel(OrganizationUser organizationUser, string obj = "organizationUser")
: base(obj)
{
throw new ArgumentNullException(nameof(organizationUser));
if (organizationUser == null)
{
throw new ArgumentNullException(nameof(organizationUser));
}
Id = organizationUser.Id.ToString();
UserId = organizationUser.UserId?.ToString();
Type = organizationUser.Type;
Status = organizationUser.Status;
AccessAll = organizationUser.AccessAll;
Permissions = CoreHelpers.LoadClassFromJsonData<Permissions>(organizationUser.Permissions);
ResetPasswordEnrolled = !string.IsNullOrEmpty(organizationUser.ResetPasswordKey);
}
Id = organizationUser.Id.ToString();
UserId = organizationUser.UserId?.ToString();
Type = organizationUser.Type;
Status = organizationUser.Status;
AccessAll = organizationUser.AccessAll;
Permissions = CoreHelpers.LoadClassFromJsonData<Permissions>(organizationUser.Permissions);
ResetPasswordEnrolled = !string.IsNullOrEmpty(organizationUser.ResetPasswordKey);
}
public OrganizationUserResponseModel(OrganizationUserUserDetails organizationUser, string obj = "organizationUser")
: base(obj)
{
if (organizationUser == null)
public OrganizationUserResponseModel(OrganizationUserUserDetails organizationUser, string obj = "organizationUser")
: base(obj)
{
throw new ArgumentNullException(nameof(organizationUser));
if (organizationUser == null)
{
throw new ArgumentNullException(nameof(organizationUser));
}
Id = organizationUser.Id.ToString();
UserId = organizationUser.UserId?.ToString();
Type = organizationUser.Type;
Status = organizationUser.Status;
AccessAll = organizationUser.AccessAll;
Permissions = CoreHelpers.LoadClassFromJsonData<Permissions>(organizationUser.Permissions);
ResetPasswordEnrolled = !string.IsNullOrEmpty(organizationUser.ResetPasswordKey);
UsesKeyConnector = organizationUser.UsesKeyConnector;
}
Id = organizationUser.Id.ToString();
UserId = organizationUser.UserId?.ToString();
Type = organizationUser.Type;
Status = organizationUser.Status;
AccessAll = organizationUser.AccessAll;
Permissions = CoreHelpers.LoadClassFromJsonData<Permissions>(organizationUser.Permissions);
ResetPasswordEnrolled = !string.IsNullOrEmpty(organizationUser.ResetPasswordKey);
UsesKeyConnector = organizationUser.UsesKeyConnector;
public string Id { get; set; }
public string UserId { get; set; }
public OrganizationUserType Type { get; set; }
public OrganizationUserStatusType Status { get; set; }
public bool AccessAll { get; set; }
public Permissions Permissions { get; set; }
public bool ResetPasswordEnrolled { get; set; }
public bool UsesKeyConnector { get; set; }
}
public string Id { get; set; }
public string UserId { get; set; }
public OrganizationUserType Type { get; set; }
public OrganizationUserStatusType Status { get; set; }
public bool AccessAll { get; set; }
public Permissions Permissions { get; set; }
public bool ResetPasswordEnrolled { get; set; }
public bool UsesKeyConnector { get; set; }
}
public class OrganizationUserDetailsResponseModel : OrganizationUserResponseModel
{
public OrganizationUserDetailsResponseModel(OrganizationUser organizationUser,
IEnumerable<SelectionReadOnly> collections)
: base(organizationUser, "organizationUserDetails")
public class OrganizationUserDetailsResponseModel : OrganizationUserResponseModel
{
Collections = collections.Select(c => new SelectionReadOnlyResponseModel(c));
}
public IEnumerable<SelectionReadOnlyResponseModel> Collections { get; set; }
}
public class OrganizationUserUserDetailsResponseModel : OrganizationUserResponseModel
{
public OrganizationUserUserDetailsResponseModel(OrganizationUserUserDetails organizationUser,
bool twoFactorEnabled, string obj = "organizationUserUserDetails")
: base(organizationUser, obj)
{
if (organizationUser == null)
public OrganizationUserDetailsResponseModel(OrganizationUser organizationUser,
IEnumerable<SelectionReadOnly> collections)
: base(organizationUser, "organizationUserDetails")
{
throw new ArgumentNullException(nameof(organizationUser));
Collections = collections.Select(c => new SelectionReadOnlyResponseModel(c));
}
Name = organizationUser.Name;
Email = organizationUser.Email;
TwoFactorEnabled = twoFactorEnabled;
SsoBound = !string.IsNullOrWhiteSpace(organizationUser.SsoExternalId);
// Prevent reset password when using key connector.
ResetPasswordEnrolled = ResetPasswordEnrolled && !organizationUser.UsesKeyConnector;
public IEnumerable<SelectionReadOnlyResponseModel> Collections { get; set; }
}
public string Name { get; set; }
public string Email { get; set; }
public bool TwoFactorEnabled { get; set; }
public bool SsoBound { get; set; }
}
public class OrganizationUserResetPasswordDetailsResponseModel : ResponseModel
{
public OrganizationUserResetPasswordDetailsResponseModel(OrganizationUserResetPasswordDetails orgUser,
string obj = "organizationUserResetPasswordDetails") : base(obj)
public class OrganizationUserUserDetailsResponseModel : OrganizationUserResponseModel
{
if (orgUser == null)
public OrganizationUserUserDetailsResponseModel(OrganizationUserUserDetails organizationUser,
bool twoFactorEnabled, string obj = "organizationUserUserDetails")
: base(organizationUser, obj)
{
throw new ArgumentNullException(nameof(orgUser));
if (organizationUser == null)
{
throw new ArgumentNullException(nameof(organizationUser));
}
Name = organizationUser.Name;
Email = organizationUser.Email;
TwoFactorEnabled = twoFactorEnabled;
SsoBound = !string.IsNullOrWhiteSpace(organizationUser.SsoExternalId);
// Prevent reset password when using key connector.
ResetPasswordEnrolled = ResetPasswordEnrolled && !organizationUser.UsesKeyConnector;
}
Kdf = orgUser.Kdf;
KdfIterations = orgUser.KdfIterations;
ResetPasswordKey = orgUser.ResetPasswordKey;
EncryptedPrivateKey = orgUser.EncryptedPrivateKey;
public string Name { get; set; }
public string Email { get; set; }
public bool TwoFactorEnabled { get; set; }
public bool SsoBound { get; set; }
}
public KdfType Kdf { get; set; }
public int KdfIterations { get; set; }
public string ResetPasswordKey { get; set; }
public string EncryptedPrivateKey { get; set; }
}
public class OrganizationUserPublicKeyResponseModel : ResponseModel
{
public OrganizationUserPublicKeyResponseModel(Guid id, Guid userId,
string key, string obj = "organizationUserPublicKeyResponseModel") :
base(obj)
public class OrganizationUserResetPasswordDetailsResponseModel : ResponseModel
{
Id = id;
UserId = userId;
Key = key;
public OrganizationUserResetPasswordDetailsResponseModel(OrganizationUserResetPasswordDetails orgUser,
string obj = "organizationUserResetPasswordDetails") : base(obj)
{
if (orgUser == null)
{
throw new ArgumentNullException(nameof(orgUser));
}
Kdf = orgUser.Kdf;
KdfIterations = orgUser.KdfIterations;
ResetPasswordKey = orgUser.ResetPasswordKey;
EncryptedPrivateKey = orgUser.EncryptedPrivateKey;
}
public KdfType Kdf { get; set; }
public int KdfIterations { get; set; }
public string ResetPasswordKey { get; set; }
public string EncryptedPrivateKey { get; set; }
}
public Guid Id { get; set; }
public Guid UserId { get; set; }
public string Key { get; set; }
}
public class OrganizationUserBulkResponseModel : ResponseModel
{
public OrganizationUserBulkResponseModel(Guid id, string error,
string obj = "OrganizationBulkConfirmResponseModel") : base(obj)
public class OrganizationUserPublicKeyResponseModel : ResponseModel
{
Id = id;
Error = error;
public OrganizationUserPublicKeyResponseModel(Guid id, Guid userId,
string key, string obj = "organizationUserPublicKeyResponseModel") :
base(obj)
{
Id = id;
UserId = userId;
Key = key;
}
public Guid Id { get; set; }
public Guid UserId { get; set; }
public string Key { get; set; }
}
public class OrganizationUserBulkResponseModel : ResponseModel
{
public OrganizationUserBulkResponseModel(Guid id, string error,
string obj = "OrganizationBulkConfirmResponseModel") : base(obj)
{
Id = id;
Error = error;
}
public Guid Id { get; set; }
public string Error { get; set; }
}
public Guid Id { get; set; }
public string Error { get; set; }
}