public Task Listen(string channelId) { var actor = Context.User.ToModel(); if (!actor.IsAdmin && !_store.CanInteract(Context.UserIdentifier, channelId).Result) { throw new ActionForbidden(); } Groups.AddToGroupAsync(Context.ConnectionId, channelId); Context.Items.Add("channelId", channelId); _cache.Connections.TryAdd(Context.ConnectionId, new CachedConnection { Id = Context.ConnectionId, ProfileId = actor.Id, ProfileName = actor.Name, Room = channelId } ); return(Clients.OthersInGroup(channelId).PresenceEvent(new BroadcastEvent(Context.User, "PRESENCE.ARRIVED"))); }
public async Task <bool> CanInteract(string subjectId, string isolationId) { return(await _store.CanInteract(subjectId, isolationId)); }