mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 16:42:50 -05:00
[Provider] Create and access child organizations (#1427)
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Settings;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
@ -9,18 +10,21 @@ namespace Bit.Notifications
|
||||
[Authorize("Application")]
|
||||
public class NotificationsHub : Microsoft.AspNetCore.SignalR.Hub
|
||||
{
|
||||
private readonly IProviderOrganizationRepository _providerOrganizationRepository;
|
||||
private readonly ConnectionCounter _connectionCounter;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public NotificationsHub(ConnectionCounter connectionCounter, GlobalSettings globalSettings)
|
||||
public NotificationsHub(IProviderOrganizationRepository providerOrganizationRepository,
|
||||
ConnectionCounter connectionCounter, GlobalSettings globalSettings)
|
||||
{
|
||||
_providerOrganizationRepository = providerOrganizationRepository;
|
||||
_connectionCounter = connectionCounter;
|
||||
_globalSettings = globalSettings;
|
||||
}
|
||||
|
||||
public override async Task OnConnectedAsync()
|
||||
{
|
||||
var currentContext = new CurrentContext();
|
||||
var currentContext = new CurrentContext(_providerOrganizationRepository);
|
||||
await currentContext.BuildAsync(Context.User, _globalSettings);
|
||||
if (currentContext.Organizations != null)
|
||||
{
|
||||
@ -35,7 +39,7 @@ namespace Bit.Notifications
|
||||
|
||||
public override async Task OnDisconnectedAsync(Exception exception)
|
||||
{
|
||||
var currentContext = new CurrentContext();
|
||||
var currentContext = new CurrentContext(_providerOrganizationRepository);
|
||||
await currentContext.BuildAsync(Context.User, _globalSettings);
|
||||
if (currentContext.Organizations != null)
|
||||
{
|
||||
|
Reference in New Issue
Block a user