1
0
mirror of https://github.com/bitwarden/server synced 2026-01-07 11:03:37 +00:00

allow user delete if they are not the only owner

This commit is contained in:
Kyle Spearrin
2017-10-25 11:36:54 -04:00
parent 461be7a14f
commit 8ba3e27a7d
7 changed files with 33 additions and 25 deletions

View File

@@ -11,7 +11,7 @@ namespace Bit.Core.Repositories
{
Task<int> GetCountByOrganizationIdAsync(Guid organizationId);
Task<int> GetCountByFreeOrganizationAdminUserAsync(Guid userId);
Task<int> GetCountByOrganizationOwnerUserAsync(Guid userId);
Task<int> GetCountByOnlyOwnerAsync(Guid userId);
Task<ICollection<OrganizationUser>> GetManyByUserAsync(Guid userId);
Task<ICollection<OrganizationUser>> GetManyByOrganizationAsync(Guid organizationId, OrganizationUserType? type);
Task<OrganizationUser> GetByOrganizationAsync(Guid organizationId, string email);

View File

@@ -49,12 +49,12 @@ namespace Bit.Core.Repositories.SqlServer
}
}
public async Task<int> GetCountByOrganizationOwnerUserAsync(Guid userId)
public async Task<int> GetCountByOnlyOwnerAsync(Guid userId)
{
using(var connection = new SqlConnection(ConnectionString))
{
var results = await connection.ExecuteScalarAsync<int>(
"[dbo].[OrganizationUser_ReadCountByOrganizationOwnerUser]",
"[dbo].[OrganizationUser_ReadCountByOnlyOwner]",
new { UserId = userId },
commandType: CommandType.StoredProcedure);