mirror of
https://github.com/bitwarden/server.git
synced 2025-07-06 10:32:49 -05:00
Organization User Accepted Invite Email Notifications (#1465)
This commit is contained in:
@ -389,5 +389,21 @@ namespace Bit.Core.Repositories.EntityFramework
|
||||
}
|
||||
|
||||
Task<ICollection<string>> IOrganizationUserRepository.SelectKnownEmailsAsync(Guid organizationId, IEnumerable<string> emails, bool onlyRegisteredUsers) => throw new NotImplementedException();
|
||||
|
||||
public async Task<IEnumerable<OrganizationUserUserDetails>> GetManyByMinimumRoleAsync(Guid organizationId, OrganizationUserType minRole)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
{
|
||||
var dbContext = GetDatabaseContext(scope);
|
||||
var query = dbContext.OrganizationUsers
|
||||
.Include(e => e.User)
|
||||
.Where(e => e.OrganizationId.Equals(organizationId) && e.Type <= minRole)
|
||||
.Select(e => new OrganizationUserUserDetails() {
|
||||
Id = e.Id,
|
||||
Email = e.Email ?? e.User.Email
|
||||
});
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,5 +37,6 @@ namespace Bit.Core.Repositories
|
||||
Task DeleteManyAsync(IEnumerable<Guid> userIds);
|
||||
Task<OrganizationUser> GetByOrganizationEmailAsync(Guid organizationId, string email);
|
||||
Task<IEnumerable<OrganizationUserPublicKey>> GetManyPublicKeysByOrganizationUserAsync(Guid organizationId, IEnumerable<Guid> Ids);
|
||||
Task<IEnumerable<OrganizationUserUserDetails>> GetManyByMinimumRoleAsync(Guid organizationId, OrganizationUserType minRole);
|
||||
}
|
||||
}
|
||||
|
@ -391,5 +391,18 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
return results.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<OrganizationUserUserDetails>> GetManyByMinimumRoleAsync(Guid organizationId, OrganizationUserType minRole)
|
||||
{
|
||||
using (var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.QueryAsync<OrganizationUserUserDetails>(
|
||||
"[dbo].[OrganizationUser_ReadByMinimumRole]",
|
||||
new { OrganizationId = organizationId, MinRole = minRole },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user