Remove: user-info collection

This commit is contained in:
Tainan Felipe 2024-04-23 14:38:07 -03:00
parent db3e46b711
commit e80cc5a223
27 changed files with 1 additions and 324 deletions

View File

@ -3,7 +3,6 @@ import AbstractCollection from '/imports/ui/services/LocalCollectionSynchronizer
// Collections
import PresentationUploadToken from '/imports/api/presentation-upload-token';
import Screenshare from '/imports/api/screenshare';
import UserInfos from '/imports/api/users-infos';
import UserSettings from '/imports/api/users-settings';
import VideoStreams from '/imports/api/video-streams';
import VoiceUsers from '/imports/api/voice-users';
@ -22,7 +21,6 @@ export const localCollectionRegistry = {
PresentationUploadToken,
),
localScreenshareSync: new AbstractCollection(Screenshare, Screenshare),
localUserInfosSync: new AbstractCollection(UserInfos, UserInfos),
localUserSettingsSync: new AbstractCollection(UserSettings, UserSettings),
localVideoStreamsSync: new AbstractCollection(VideoStreams, VideoStreams),
localVoiceUsersSync: new AbstractCollection(VoiceUsers, VoiceUsers),

View File

@ -8,7 +8,6 @@ import clearUsersSettings from '/imports/api/users-settings/server/modifiers/cle
import clearBreakouts from '/imports/api/breakouts/server/modifiers/clearBreakouts';
import clearPads from '/imports/api/pads/server/modifiers/clearPads';
import clearVoiceUsers from '/imports/api/voice-users/server/modifiers/clearVoiceUsers';
import clearUserInfo from '/imports/api/users-infos/server/modifiers/clearUserInfo';
import clearScreenshare from '/imports/api/screenshare/server/modifiers/clearScreenshare';
import clearTimer from '/imports/api/timer/server/modifiers/clearTimer';
import clearMeetingTimeRemaining from '/imports/api/meetings/server/modifiers/clearMeetingTimeRemaining';
@ -28,13 +27,11 @@ export default async function meetingHasEnded(meetingId) {
await Meetings.removeAsync({ meetingId });
await Promise.all([
clearCaptions(meetingId),
clearPads(meetingId),
clearBreakouts(meetingId),
clearUsers(meetingId),
clearUsersSettings(meetingId),
clearVoiceUsers(meetingId),
clearUserInfo(meetingId),
clearTimer(meetingId),
clearMeetingTimeRemaining(meetingId),
clearRecordMeeting(meetingId),

View File

@ -1,13 +0,0 @@
import { Meteor } from 'meteor/meteor';
const collectionOptions = Meteor.isClient ? {
connection: null,
} : {};
const UserInfos = new Mongo.Collection('users-infos', collectionOptions);
if (Meteor.isServer) {
UserInfos.createIndexAsync({ meetingId: 1, userId: 1 });
}
export default UserInfos;

View File

@ -1,4 +0,0 @@
import RedisPubSub from '/imports/startup/server/redis';
import handleUserInformation from './handlers/userInformation';
RedisPubSub.on('LookUpUserRespMsg', handleUserInformation);

View File

@ -1,17 +0,0 @@
import { check } from 'meteor/check';
import addUserInfo from '../modifiers/addUserInfo';
export default async function handleUserInformation({ header, body }) {
check(body, Object);
check(header, Object);
const { userInfo } = body;
const { userId, meetingId } = header;
check(userInfo, Array);
check(userId, String);
check(meetingId, String);
const result = await addUserInfo(userInfo, userId, meetingId);
return result;
}

View File

@ -1,3 +0,0 @@
import './eventHandlers';
import './methods';
import './publishers';

View File

@ -1,6 +0,0 @@
import { Meteor } from 'meteor/meteor';
import removeUserInformation from './methods/removeUserInformation';
Meteor.methods({
removeUserInformation,
});

View File

@ -1,26 +0,0 @@
import UserInfos from '/imports/api/users-infos';
import Logger from '/imports/startup/server/logger';
import { extractCredentials } from '/imports/api/common/server/helpers';
import { check } from 'meteor/check';
export default async function removeUserInformation() {
try {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
check(meetingId, String);
check(requesterUserId, String);
const selector = {
meetingId,
requesterUserId,
};
const numberAffected = await UserInfos.removeAsync(selector);
if (numberAffected) {
Logger.info(`Removed user information: requester id=${requesterUserId} meeting=${meetingId}`);
}
} catch (err) {
Logger.error(`Exception while invoking method removeUserInformation ${err.stack}`);
}
}

View File

@ -1,20 +0,0 @@
import UserInfos from '/imports/api/users-infos';
import Logger from '/imports/startup/server/logger';
export default async function addUserInfo(userInfo, requesterUserId, meetingId) {
const info = {
meetingId,
requesterUserId,
userInfo,
};
try {
const numberAffected = await UserInfos.insertAsync(info);
if (numberAffected) {
Logger.info(`Added user information: requester id=${requesterUserId} meeting=${meetingId}`);
}
} catch (err) {
Logger.error(`Adding user information to collection: ${err}`);
}
}

View File

@ -1,14 +0,0 @@
import UserInfos from '/imports/api/users-infos';
import Logger from '/imports/startup/server/logger';
export default async function clearUsersInfo(meetingId) {
try {
const numberAffected = await UserInfos.removeAsync({ meetingId });
if (numberAffected) {
Logger.info(`Cleared User Infos (${meetingId})`);
}
} catch (err) {
Logger.error(`Error on clearing User Infos (${meetingId}). ${err}`);
}
}

View File

@ -1,14 +0,0 @@
import UserInfos from '/imports/api/users-infos';
import Logger from '/imports/startup/server/logger';
export default async function clearUsersInfoForRequester(meetingId, requesterUserId) {
try {
const numberAffected = await UserInfos.removeAsync({ meetingId });
if (numberAffected) {
Logger.info(`Cleared User Infos requested by user=${requesterUserId}`);
}
} catch (err) {
Logger.info(`Error on clearing User Infos requested by user=${requesterUserId}. ${err}`);
}
}

View File

@ -1,27 +0,0 @@
import { Meteor } from 'meteor/meteor';
import UserInfos from '/imports/api/users-infos';
import Logger from '/imports/startup/server/logger';
import AuthTokenValidation, { ValidationStates } from '/imports/api/auth-token-validation';
async function userInfos() {
const tokenValidation = await AuthTokenValidation
.findOneAsync({ connectionId: this.connection.id });
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
Logger.warn(`Publishing UserInfos was requested by unauth connection ${this.connection.id}`);
return UserInfos.find({ meetingId: '' });
}
const { meetingId, userId: requesterUserId } = tokenValidation;
Logger.debug('Publishing UserInfos requested', { meetingId, requesterUserId });
return UserInfos.find({ meetingId, requesterUserId });
}
function publish(...args) {
const boundUserInfos = userInfos.bind(this);
return boundUserInfos(...args);
}
Meteor.publish('users-infos', publish);

View File

@ -2,7 +2,6 @@ import { check } from 'meteor/check';
import Users from '/imports/api/users';
import VideoStreams from '/imports/api/video-streams';
import Logger from '/imports/startup/server/logger';
import clearUserInfoForRequester from '/imports/api/users-infos/server/modifiers/clearUserInfoForRequester';
import ClientConnections from '/imports/startup/server/ClientConnections';
import userEjected from '/imports/api/users/server/modifiers/userEjected';
import clearVoiceUser from '/imports/api/voice-users/server/modifiers/clearVoiceUser';
@ -42,8 +41,6 @@ export default async function removeUser(body, meetingId) {
await VideoStreams.removeAsync({ meetingId, userId });
await clearUserInfoForRequester(meetingId, userId);
await Users.removeAsync(selector);
await clearVoiceUser(meetingId, userId);
}

View File

@ -1,7 +1,6 @@
import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import Users from '/imports/api/users';
import clearUserInfoForRequester from '/imports/api/users-infos/server/modifiers/clearUserInfoForRequester';
export default async function userEjected(meetingId, userId, ejectedReason) {
check(meetingId, String);
@ -24,7 +23,6 @@ export default async function userEjected(meetingId, userId, ejectedReason) {
const numberAffected = await Users.updateAsync(selector, modifier);
if (numberAffected) {
await clearUserInfoForRequester(meetingId, userId);
Logger.info(`Ejected user id=${userId} meeting=${meetingId} reason=${ejectedReason}`);
}
} catch (err) {

View File

@ -57,7 +57,6 @@ export interface App {
askForConfirmationOnLeave: boolean
wakeLock: WakeLock
allowDefaultLogoutUrl: boolean
allowUserLookup: boolean
dynamicGuestPolicy: boolean
enableGuestLobbyMessage: boolean
guestPolicyExtraAllowOptions: boolean

View File

@ -8,7 +8,6 @@ import deviceInfo from '/imports/utils/deviceInfo';
import PollingContainer from '/imports/ui/components/polling/container';
import logger from '/imports/startup/client/logger';
import ActivityCheckContainer from '/imports/ui/components/activity-check/container';
import UserInfoContainer from '/imports/ui/components/user-info/container';
import BreakoutRoomInvitation from '/imports/ui/components/breakout-room/invitation/container';
import ToastContainer from '/imports/ui/components/common/toast/container';
import PadsSessionsContainer from '/imports/ui/components/pads/pads-graphql/sessions/component';
@ -452,18 +451,6 @@ class App extends Component {
) : null);
}
renderUserInformation() {
const { UserInfo, User } = this.props;
return (UserInfo.length > 0 ? (
<UserInfoContainer
UserInfo={UserInfo}
requesterUserId={User.userId}
meetingId={User.meetingId}
/>
) : null);
}
renderDarkMode() {
const { darkTheme } = this.props;
@ -564,7 +551,6 @@ setRandomUserSelectModalIsOpen(value) {
presentationIsOpen,
darkTheme,
intl,
isModerator,
genericComponentId,
} = this.props;
@ -591,7 +577,6 @@ setRandomUserSelectModalIsOpen(value) {
}}
>
{this.renderActivityCheck()}
{this.renderUserInformation()}
<ScreenReaderAlertContainer />
<BannerBarContainer />
<NotificationsBarContainer />

View File

@ -7,7 +7,6 @@ import AudioCaptionsLiveContainer from '/imports/ui/components/audio/audio-graph
import { notify } from '/imports/ui/services/notification';
import getFromUserSettings from '/imports/ui/services/users-settings';
import deviceInfo from '/imports/utils/deviceInfo';
import UserInfos from '/imports/api/users-infos';
import Settings from '/imports/ui/services/settings';
import MediaService from '/imports/ui/components/media/service';
import { isPresentationEnabled, isExternalVideoEnabled } from '/imports/ui/services/features';
@ -276,10 +275,6 @@ export default withTracker(() => {
const meetingPresentationIsOpen = !layout.presentationMinimized;
const UserInfo = UserInfos.find({
meetingId: Auth.meetingID,
requesterUserId: Auth.userID,
}).fetch();
const AppSettings = Settings.application;
const { selectedLayout, pushLayout } = AppSettings;
@ -299,7 +294,6 @@ export default withTracker(() => {
hasBreakoutRooms: getBreakoutRooms().length > 0,
customStyle: getFromUserSettings('bbb_custom_style', false),
customStyleUrl,
UserInfo,
notify,
isPhone: deviceInfo.isPhone,
isRTL: document.documentElement.getAttribute('dir') === 'rtl',

View File

@ -1,70 +0,0 @@
import React, { Component } from 'react';
import { defineMessages } from 'react-intl';
import PropTypes from 'prop-types';
import ModalSimple from '/imports/ui/components/common/modal/simple/component';
import Service from './service';
import Styled from './styles';
const propTypes = {
intl: PropTypes.object.isRequired,
meetingId: PropTypes.string.isRequired,
requesterUserId: PropTypes.string.isRequired,
};
const intlMessages = defineMessages({
title: {
id: 'app.user-info.title',
description: 'User info title label',
},
});
class UserInfoComponent extends Component {
renderUserInfo() {
const { UserInfo } = this.props;
const userInfoList = UserInfo.map((user, index, array) => {
const infoList = user.userInfo.map((info) => {
const key = Object.keys(info)[0];
return (
<tr key={key}>
<Styled.KeyCell>{key}</Styled.KeyCell>
<Styled.ValueCell>{info[key]}</Styled.ValueCell>
</tr>
);
});
if (array.length > 1) {
infoList.unshift(
<tr key={infoList.length}>
<th>{`User ${index + 1}`}</th>
</tr>,
);
}
return infoList;
});
return (
<Styled.UserInfoTable>
<tbody>
{userInfoList}
</tbody>
</Styled.UserInfoTable>
);
}
render() {
const { intl } = this.props;
return (
<ModalSimple
title={intl.formatMessage(intlMessages.title)}
onRequestClose={() => Service.handleCloseUserInfo()}
>
{this.renderUserInfo()}
</ModalSimple>
);
}
}
UserInfoComponent.propTypes = propTypes;
export default UserInfoComponent;

View File

@ -1,7 +0,0 @@
import React from 'react';
import { injectIntl } from 'react-intl';
import UserInfo from './component';
const UserInfoContainer = props => <UserInfo {...props} />;
export default injectIntl(UserInfoContainer);

View File

@ -1,7 +0,0 @@
import { makeCall } from '/imports/ui/services/api';
export default {
handleCloseUserInfo: () => {
makeCall('removeUserInformation');
},
};

View File

@ -1,33 +0,0 @@
import styled from 'styled-components';
import { mdPaddingX, borderSize } from '/imports/ui/stylesheets/styled-components/general';
import { colorGrayLighter } from '/imports/ui/stylesheets/styled-components/palette';
const KeyCell = styled.td`
padding: ${mdPaddingX};
border: ${borderSize} solid ${colorGrayLighter};
`;
const ValueCell = styled.td`
padding: ${mdPaddingX};
border: ${borderSize} solid ${colorGrayLighter};
`;
const UserInfoTable = styled.table`
border: ${borderSize} solid ${colorGrayLighter};
border-collapse: collapse;
border: none;
width: 90%;
margin: auto;
table-layout: fixed;
& > td {
word-wrap: break-word;
}`;
export default {
KeyCell,
ValueCell,
UserInfoTable,
};

View File

@ -278,7 +278,6 @@ const UserActions: React.FC<UserActionsProps> = ({
allowedToPromote,
allowedToDemote,
allowedToChangeUserLockStatus,
allowUserLookup,
allowedToRemove,
allowedToEjectCameras,
allowedToSetAway,
@ -313,7 +312,6 @@ const UserActions: React.FC<UserActionsProps> = ({
const [setEmojiStatus] = useMutation(SET_EMOJI_STATUS);
const [setLocked] = useMutation(SET_LOCKED);
const [userEjectCameras] = useMutation(USER_EJECT_CAMERAS);
const [requestUserInfo] = useMutation(REQUEST_USER_INFO);
const removeUser = (userId: string, banUser: boolean) => {
if (isVoiceOnlyUser(user.userId)) {
@ -522,20 +520,6 @@ const UserActions: React.FC<UserActionsProps> = ({
icon: userLocked ? 'unlock' : 'lock',
dataTest: 'unlockUserButton',
},
{
allowed: allowUserLookup,
key: 'directoryLookup',
label: intl.formatMessage(messages.DirectoryLookupLabel),
onClick: () => {
requestUserInfo({
variables: {
extId: user.extId,
},
});
setOpenUserAction(null);
},
icon: 'user',
},
{
allowed: allowedToRemove,
key: 'remove',

View File

@ -33,18 +33,9 @@ export const CHAT_CREATE_WITH_USER = gql`
}
`;
export const REQUEST_USER_INFO = gql`
mutation RequestUserInfo($extId: String!) {
userThirdPartyInfoResquest(
externalUserId: $extId
)
}
`;
export default {
SET_AWAY,
SET_ROLE,
USER_EJECT_CAMERAS,
CHAT_CREATE_WITH_USER,
REQUEST_USER_INFO,
};

View File

@ -87,8 +87,6 @@ export const generateActionsPermissions = (
&& !isDialInUser;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - temporary, while meteor exists in the project
const { allowUserLookup } = window.meetingClientSettings.public.app;
const allowedToSetAway = amISubjectUser && !USER_STATUS_ENABLED;
return {
@ -104,7 +102,6 @@ export const generateActionsPermissions = (
allowedToChangeUserLockStatus,
allowedToChangeWhiteboardAccess,
allowedToEjectCameras,
allowUserLookup,
allowedToSetAway,
};
};

View File

@ -41,7 +41,7 @@ export const meetingClientSettingsInitialValues: MeetingClientSettings = {
enabled: true,
},
allowDefaultLogoutUrl: true,
allowUserLookup: false,
dynamicGuestPolicy: true,
enableGuestLobbyMessage: true,
guestPolicyExtraAllowOptions: false,

View File

@ -63,7 +63,6 @@ public:
wakeLock:
enabled: true
allowDefaultLogoutUrl: true
allowUserLookup: false
dynamicGuestPolicy: true
enableGuestLobbyMessage: true
guestPolicyExtraAllowOptions: false

View File

@ -10,7 +10,6 @@ import '/imports/api/users-settings/server';
import '/imports/api/voice-users/server';
import '/imports/api/whiteboard-multi-user/server';
import '/imports/api/video-streams/server';
import '/imports/api/users-infos/server';
import '/imports/api/connection-status/server';
import '/imports/api/timer/server';
import '/imports/api/pads/server';