381c5cb15c
Modified the previous implementation of the whiteboard individual access to remove multiple Collections dependency on this feature. Multi-user whiteboard is now an array instead of a boolean value and most of the access control can be synchronized and handled by akka-apps.
32 lines
635 B
JavaScript
32 lines
635 B
JavaScript
import Users from '/imports/api/users';
|
|
import WhiteboardMultiUser from '/imports/api/whiteboard-multi-user/';
|
|
|
|
const getMultiUser = (meetingId, whiteboardId) => {
|
|
const data = WhiteboardMultiUser.findOne(
|
|
{
|
|
meetingId,
|
|
whiteboardId,
|
|
}, { fields: { multiUser: 1 } },
|
|
);
|
|
|
|
if (!data || !data.multiUser || !Array.isArray(data.multiUser)) return [];
|
|
|
|
return data.multiUser;
|
|
};
|
|
|
|
const getUsers = (meetingId) => {
|
|
const data = Users.find(
|
|
{ meetingId },
|
|
{ fields: { userId: 1 } },
|
|
).fetch();
|
|
|
|
if (!data) return [];
|
|
|
|
return data.map(user => user.userId);
|
|
};
|
|
|
|
export {
|
|
getMultiUser,
|
|
getUsers,
|
|
};
|