Merge pull request #19294 from gustavotrott/graphql-actions-mod

graphql-actions: Moderators actions
This commit is contained in:
Gustavo Trott 2023-12-06 13:11:40 -03:00 committed by GitHub
commit c24d5bf914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 380 additions and 0 deletions

View File

@ -0,0 +1,24 @@
import { RedisMessage } from '../types';
import {throwErrorIfNotModerator} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotModerator(sessionVariables);
const eventName = 'LogoutAndEndMeetingCmdMsg';
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
userId: routing.userId
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,30 @@
import { RedisMessage } from '../types';
import {throwErrorIfNotModerator} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotModerator(sessionVariables);
const eventName = 'BroadcastLayoutMsg';
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
layout: input.layout,
pushLayout: input.syncWithPresenterLayout,
presentationIsOpen: input.presentationIsOpen,
isResizing: input.isResizing,
cameraPosition: input.cameraPosition || "",
focusedCamera: input.focusedCamera,
presentationVideoRate: input.presentationVideoRate
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,24 @@
import { RedisMessage } from '../types';
import {throwErrorIfNotModerator} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotModerator(sessionVariables);
const eventName = 'BroadcastPushLayoutMsg';
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
pushLayout: input.syncWithPresenterLayout
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,34 @@
import { RedisMessage } from '../types';
import {throwErrorIfNotModerator} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotModerator(sessionVariables);
const eventName = 'ChangeLockSettingsInMeetingCmdMsg';
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
setBy: routing.userId,
disableCam: input.disableCam,
disableMic: input.disableMic,
disablePrivChat: input.disablePrivChat,
disablePubChat: input.disablePubChat,
disableNotes: input.disableNotes,
hideUserList: input.hideUserList,
lockOnJoin: input.lockOnJoin,
lockOnJoinConfigurable: input.lockOnJoinConfigurable,
hideViewersCursor: input.hideViewersCursor,
hideViewersAnnotation: input.hideViewersAnnotation,
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,42 @@
import { RedisMessage } from '../types';
import {throwErrorIfNotModerator} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotModerator(sessionVariables);
const eventName = 'SetRecordingStatusCmdMsg';
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
setBy: routing.userId,
recording: input.recording
};
//TODO check if backend velidate it
// const recordObject = await RecordMeetings.findOneAsync({ meetingId });
//
// if (recordObject != null) {
// const {
// allowStartStopRecording,
// recording,
// record,
// } = recordObject;
//
// meetingRecorded = recording;
// allowedToRecord = record && allowStartStopRecording; // TODO-- remove some day
// }
//
// if (allowedToRecord) {}
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,28 @@
import { RedisMessage } from '../types';
import {throwErrorIfNotModerator} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotModerator(sessionVariables);
const eventName =
(input.exceptPresenter || false) ?
'MuteAllExceptPresentersCmdMsg' :
'MuteMeetingCmdMsg';
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
mutedBy: routing.userId,
mute: input.muted
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,25 @@
import { RedisMessage } from '../types';
import {throwErrorIfNotModerator} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotModerator(sessionVariables);
const eventName = 'UpdateWebcamsOnlyForModeratorCmdMsg';
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
setBy: routing.userId,
webcamsOnlyForModerator: input.webcamsOnlyForModerator
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,24 @@
import { RedisMessage } from '../types';
import {throwErrorIfNotModerator} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotModerator(sessionVariables);
const eventName = 'EjectUserCamerasCmdMsg';
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
userId: input.userId
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,26 @@
import { RedisMessage } from '../types';
import {throwErrorIfNotModerator} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotModerator(sessionVariables);
const eventName = 'EjectUserFromVoiceCmdMsg';
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
ejectedBy: routing.userId,
userId: input.userId,
banUser: input.banUser || false
};
return { eventName, routing, header, body };
}

View File

@ -111,6 +111,62 @@ type Mutation {
): Boolean
}
type Mutation {
meetingEnd: Boolean
}
type Mutation {
meetingLayoutSetProps(
layout: String!
syncWithPresenterLayout: Boolean!
presentationIsOpen: Boolean!
isResizing: Boolean!
cameraPosition: String
focusedCamera: String!
presentationVideoRate: Float!
): Boolean
}
type Mutation {
meetingLayoutSetSyncWithPresenterLayout(
syncWithPresenterLayout: Boolean!
): Boolean
}
type Mutation {
meetingLockSettingsSetProps(
disableCam: Boolean!
disableMic: Boolean!
disablePrivChat: Boolean!
disablePubChat: Boolean!
disableNotes: Boolean!
hideUserList: Boolean!
lockOnJoin: Boolean!
lockOnJoinConfigurable: Boolean!
hideViewersCursor: Boolean!
hideViewersAnnotation: Boolean!
): Boolean
}
type Mutation {
meetingRecordingSetStatus(
recording: Boolean!
): Boolean
}
type Mutation {
meetingSetMuted(
muted: Boolean!
exceptPresenter: Boolean
): Boolean
}
type Mutation {
meetingSetWebcamOnlyForModerator(
webcamsOnlyForModerator: Boolean!
): Boolean
}
type Mutation {
pickRandomViewer: Boolean
}
@ -256,6 +312,12 @@ type Mutation {
): Boolean
}
type Mutation {
userEjectCameras(
userId: String!
): Boolean
}
type Mutation {
userEjectFromMeeting(
userId: String!
@ -263,6 +325,13 @@ type Mutation {
): Boolean
}
type Mutation {
userEjectFromVoice(
userId: String!
banUser: Boolean
): Boolean
}
type Mutation {
userJoinMeeting(
authToken: String!

View File

@ -107,6 +107,48 @@ actions:
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: meetingEnd
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: meetingLayoutSetProps
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: meetingLayoutSetSyncWithPresenterLayout
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: meetingLockSettingsSetProps
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: meetingRecordingSetStatus
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: meetingSetMuted
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: meetingSetWebcamOnlyForModerator
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: pickRandomViewer
definition:
kind: synchronous
@ -245,12 +287,24 @@ actions:
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: userEjectCameras
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: userEjectFromMeeting
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: userEjectFromVoice
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: userJoinMeeting
definition:
kind: synchronous