2014-10-01 01:12:47 +08:00
|
|
|
# --------------------------------------------------------------------------------------------
|
|
|
|
# Public methods on server
|
|
|
|
# All these method must first authenticate the user before it calls the private function counterpart below
|
2014-10-02 22:15:45 +08:00
|
|
|
# which sends the request to bbbApps. If the method is modifying the media the current user is sharing,
|
|
|
|
# you should perform the request before sending the request to bbbApps. This allows the user request to be performed
|
2015-05-06 04:15:33 +08:00
|
|
|
# immediately, since they do not require permission for things such as muting themsevles.
|
2014-10-01 01:12:47 +08:00
|
|
|
# --------------------------------------------------------------------------------------------
|
2014-06-20 00:57:43 +08:00
|
|
|
Meteor.methods
|
2015-04-02 23:07:58 +08:00
|
|
|
# meetingId: the meetingId of the meeting the user is in
|
|
|
|
# toSetUserId: the userId of the user joining
|
|
|
|
# requesterUserId: the userId of the requester
|
|
|
|
# requesterToken: the authToken of the requester
|
2015-04-03 04:11:09 +08:00
|
|
|
listenOnlyRequestToggle: (meetingId, userId, authToken, isJoining) ->
|
|
|
|
voiceConf = Meteor.Meetings.findOne({meetingId:meetingId})?.voiceConf
|
|
|
|
username = Meteor.Users.findOne({meetingId:meetingId, userId:userId})?.user.name
|
|
|
|
if isJoining
|
|
|
|
if isAllowedTo('joinListenOnly', meetingId, userId, authToken)
|
|
|
|
message =
|
|
|
|
payload:
|
|
|
|
userid: userId
|
|
|
|
meeting_id: meetingId
|
2015-04-17 03:06:04 +08:00
|
|
|
voice_conf: voiceConf
|
2015-04-03 04:11:09 +08:00
|
|
|
name: username
|
|
|
|
header:
|
|
|
|
timestamp: new Date().getTime()
|
|
|
|
name: "user_connected_to_global_audio"
|
|
|
|
version: "0.0.1"
|
2015-04-02 23:07:58 +08:00
|
|
|
|
2015-04-03 04:11:09 +08:00
|
|
|
Meteor.log.info "publishing a user listenOnly toggleRequest #{isJoining} request for #{userId}"
|
2015-04-02 23:07:58 +08:00
|
|
|
|
2015-04-17 03:06:04 +08:00
|
|
|
publish Meteor.config.redis.channels.toBBBApps.meeting, message
|
2015-04-13 19:08:03 +08:00
|
|
|
|
2015-04-03 04:11:09 +08:00
|
|
|
else
|
|
|
|
if isAllowedTo('leaveListenOnly', meetingId, userId, authToken)
|
|
|
|
message =
|
|
|
|
payload:
|
|
|
|
userid: userId
|
|
|
|
meeting_id: meetingId
|
2015-04-17 03:06:04 +08:00
|
|
|
voice_conf: voiceConf
|
2015-04-03 04:11:09 +08:00
|
|
|
name: username
|
|
|
|
header:
|
|
|
|
timestamp: new Date().getTime()
|
|
|
|
name: "user_disconnected_from_global_audio"
|
|
|
|
version: "0.0.1"
|
2015-04-02 23:07:58 +08:00
|
|
|
|
2015-04-03 04:11:09 +08:00
|
|
|
Meteor.log.info "publishing a user listenOnly toggleRequest #{isJoining} request for #{userId}"
|
2015-04-02 23:07:58 +08:00
|
|
|
|
2015-04-17 03:06:04 +08:00
|
|
|
publish Meteor.config.redis.channels.toBBBApps.meeting, message
|
2015-04-13 19:08:03 +08:00
|
|
|
|
2015-04-02 23:07:58 +08:00
|
|
|
return
|
|
|
|
|
2014-11-19 03:35:51 +08:00
|
|
|
# meetingId: the meetingId of the meeting the user[s] is in
|
2015-05-06 04:15:33 +08:00
|
|
|
# toMuteUserId: the userId of the user to be muted
|
2014-11-19 03:35:51 +08:00
|
|
|
# requesterUserId: the userId of the requester
|
2014-11-22 01:45:44 +08:00
|
|
|
# requesterToken: the authToken of the requester
|
2015-05-06 04:15:33 +08:00
|
|
|
muteUser: (meetingId, toMuteUserId, requesterUserId, requesterToken) ->
|
2014-11-19 03:35:51 +08:00
|
|
|
action = ->
|
2015-05-06 04:15:33 +08:00
|
|
|
if toMuteUserId is requesterUserId
|
|
|
|
return 'muteSelf'
|
2014-11-19 03:35:51 +08:00
|
|
|
else
|
2015-05-06 04:15:33 +08:00
|
|
|
return 'muteOther'
|
2014-11-19 03:35:51 +08:00
|
|
|
|
2014-11-22 01:45:44 +08:00
|
|
|
if isAllowedTo(action(), meetingId, requesterUserId, requesterToken)
|
2014-11-19 00:28:00 +08:00
|
|
|
message =
|
2014-11-19 03:35:51 +08:00
|
|
|
payload:
|
2015-09-15 03:55:04 +08:00
|
|
|
user_id: toMuteUserId
|
2014-11-19 03:35:51 +08:00
|
|
|
meeting_id: meetingId
|
2015-05-06 04:15:33 +08:00
|
|
|
mute: true
|
2014-11-19 03:35:51 +08:00
|
|
|
requester_id: requesterUserId
|
|
|
|
header:
|
|
|
|
timestamp: new Date().getTime()
|
2015-09-15 03:55:04 +08:00
|
|
|
name: "mute_user_request_message"
|
2014-11-19 03:35:51 +08:00
|
|
|
version: "0.0.1"
|
|
|
|
|
2015-05-06 04:15:33 +08:00
|
|
|
Meteor.log.info "publishing a user mute request for #{toMuteUserId}"
|
2014-11-19 00:28:00 +08:00
|
|
|
|
2015-09-15 03:55:04 +08:00
|
|
|
publish Meteor.config.redis.channels.toBBBApps.users, message
|
2015-05-06 04:15:33 +08:00
|
|
|
updateVoiceUser meetingId, {'web_userid': toMuteUserId, talking:false, muted:true}
|
2014-11-19 03:35:51 +08:00
|
|
|
return
|
2014-11-19 00:28:00 +08:00
|
|
|
|
2015-05-06 04:15:33 +08:00
|
|
|
# meetingId: the meetingId of the meeting the user[s] is in
|
|
|
|
# toMuteUserId: the userId of the user to be unmuted
|
|
|
|
# requesterUserId: the userId of the requester
|
|
|
|
# requesterToken: the authToken of the requester
|
|
|
|
unmuteUser: (meetingId, toMuteUserId, requesterUserId, requesterToken) ->
|
|
|
|
action = ->
|
|
|
|
if toMuteUserId is requesterUserId
|
|
|
|
return 'unmuteSelf'
|
|
|
|
else
|
|
|
|
return 'unmuteOther'
|
|
|
|
|
|
|
|
if isAllowedTo(action(), meetingId, requesterUserId, requesterToken)
|
|
|
|
message =
|
|
|
|
payload:
|
2015-09-15 03:55:04 +08:00
|
|
|
user_id: toMuteUserId
|
2015-05-06 04:15:33 +08:00
|
|
|
meeting_id: meetingId
|
|
|
|
mute: false
|
|
|
|
requester_id: requesterUserId
|
|
|
|
header:
|
|
|
|
timestamp: new Date().getTime()
|
2015-09-15 03:55:04 +08:00
|
|
|
name: "mute_user_request_message"
|
2015-05-06 04:15:33 +08:00
|
|
|
version: "0.0.1"
|
|
|
|
|
|
|
|
Meteor.log.info "publishing a user unmute request for #{toMuteUserId}"
|
|
|
|
|
2015-09-15 03:55:04 +08:00
|
|
|
publish Meteor.config.redis.channels.toBBBApps.users, message
|
2015-05-06 04:15:33 +08:00
|
|
|
updateVoiceUser meetingId, {'web_userid': toMuteUserId, talking:false, muted:false}
|
|
|
|
return
|
|
|
|
|
2015-10-02 03:41:43 +08:00
|
|
|
userSetEmoji: (meetingId, toRaiseUserId, raisedByUserId, raisedByToken, status) ->
|
|
|
|
if isAllowedTo('setEmojiStatus', meetingId, raisedByUserId, raisedByToken)
|
|
|
|
message =
|
|
|
|
payload:
|
|
|
|
emoji_status: status
|
|
|
|
userid: toRaiseUserId
|
|
|
|
meeting_id: meetingId
|
|
|
|
header:
|
|
|
|
timestamp: new Date().getTime()
|
|
|
|
name: "user_emoji_status_message"
|
|
|
|
version: "0.0.1"
|
|
|
|
|
|
|
|
# publish to pubsub
|
|
|
|
publish Meteor.config.redis.channels.toBBBApps.users, message
|
|
|
|
return
|
|
|
|
|
2014-11-19 06:03:13 +08:00
|
|
|
# meetingId: the meeting where the user is
|
|
|
|
# userId: the userid of the user logging out
|
2014-11-22 01:45:44 +08:00
|
|
|
# authToken: the authToken of the user
|
|
|
|
userLogout: (meetingId, userId, authToken) ->
|
|
|
|
if isAllowedTo('logoutSelf', meetingId, userId, authToken)
|
2014-11-19 06:03:13 +08:00
|
|
|
Meteor.log.info "a user is logging out from #{meetingId}:" + userId
|
|
|
|
requestUserLeaving meetingId, userId
|
2014-09-25 22:45:13 +08:00
|
|
|
|
|
|
|
# --------------------------------------------------------------------------------------------
|
|
|
|
# Private methods on server
|
|
|
|
# --------------------------------------------------------------------------------------------
|
2014-10-08 04:08:36 +08:00
|
|
|
|
2014-09-26 01:21:46 +08:00
|
|
|
# Only callable from server
|
2014-10-08 04:08:36 +08:00
|
|
|
# Received information from BBB-Apps that a user left
|
|
|
|
# Need to update the collection
|
2014-10-08 04:34:03 +08:00
|
|
|
# params: meetingid, userid as defined in BBB-Apps
|
2014-11-22 04:51:37 +08:00
|
|
|
@markUserOffline = (meetingId, userId) ->
|
2014-11-22 04:29:07 +08:00
|
|
|
# mark the user as offline. remove from the collection on meeting_end #TODO
|
2014-12-10 04:45:20 +08:00
|
|
|
Meteor.log.info "marking user [#{userId}] as offline in meeting[#{meetingId}]"
|
2014-11-22 04:29:07 +08:00
|
|
|
Meteor.Users.update({'meetingId': meetingId, 'userId': userId}, {$set:{'user.connection_status':'offline'}})
|
2015-10-27 06:54:49 +08:00
|
|
|
# result = Meteor.Users.remove({'meetingId': meetingId, 'userId': userId})
|
|
|
|
# Meteor.log.error "result on markUserOffline=#{result}"
|
|
|
|
|
2014-11-22 04:29:07 +08:00
|
|
|
|
2014-10-08 04:34:03 +08:00
|
|
|
# Corresponds to a valid action on the HTML clientside
|
|
|
|
# After authorization, publish a user_leaving_request in redis
|
2014-11-19 06:03:13 +08:00
|
|
|
# params: meetingid, userid as defined in BBB-App
|
|
|
|
@requestUserLeaving = (meetingId, userId) ->
|
2015-10-27 06:54:49 +08:00
|
|
|
userObject = Meteor.Users.findOne({'meetingId': meetingId, 'userId': userId})
|
|
|
|
voiceConf = Meteor.Meetings.findOne({meetingId:meetingId})?.voiceConf
|
|
|
|
if userObject? and voiceConf? and userId? and meetingId?
|
|
|
|
|
|
|
|
# end listenOnly audio for the departing user
|
|
|
|
if userObject.user.listenOnly
|
|
|
|
# Meteor.log.info("~~~~~~~YES, was in listenOnly")
|
|
|
|
listenOnlyMessage =
|
|
|
|
payload:
|
|
|
|
userid: userId
|
|
|
|
meeting_id: meetingId
|
|
|
|
voice_conf: voiceConf
|
|
|
|
name: userObject.user.name
|
|
|
|
header:
|
|
|
|
timestamp: new Date().getTime()
|
|
|
|
name: "user_disconnected_from_global_audio"
|
|
|
|
|
|
|
|
publish Meteor.config.redis.channels.toBBBApps.meeting, listenOnlyMessage
|
|
|
|
|
|
|
|
# remove user from meeting
|
2014-11-19 00:28:00 +08:00
|
|
|
message =
|
2014-11-19 06:03:13 +08:00
|
|
|
payload:
|
|
|
|
meeting_id: meetingId
|
|
|
|
userid: userId
|
|
|
|
header:
|
|
|
|
timestamp: new Date().getTime()
|
|
|
|
name: "user_leaving_request"
|
|
|
|
|
2015-10-27 06:54:49 +08:00
|
|
|
Meteor.log.info "sending a user_leaving_request for #{meetingId}:#{userId}"
|
|
|
|
publish Meteor.config.redis.channels.toBBBApps.users, message
|
|
|
|
else
|
|
|
|
Meteor.log.info "did not have enough information to send a user_leaving_request"
|
|
|
|
|
2014-10-08 04:08:36 +08:00
|
|
|
|
2014-09-26 01:21:46 +08:00
|
|
|
#update a voiceUser - a helper method
|
2014-10-11 05:35:51 +08:00
|
|
|
@updateVoiceUser = (meetingId, voiceUserObject) ->
|
2014-11-19 00:28:00 +08:00
|
|
|
u = Meteor.Users.findOne userId: voiceUserObject.web_userid
|
|
|
|
if u?
|
|
|
|
if voiceUserObject.talking?
|
2014-11-21 06:01:26 +08:00
|
|
|
Meteor.Users.update({meetingId: meetingId ,userId: voiceUserObject.web_userid}, {$set: {'user.voiceUser.talking':voiceUserObject.talking}}) # talking
|
2014-11-19 00:28:00 +08:00
|
|
|
if voiceUserObject.joined?
|
2014-11-21 06:01:26 +08:00
|
|
|
Meteor.Users.update({meetingId: meetingId ,userId: voiceUserObject.web_userid}, {$set: {'user.voiceUser.joined':voiceUserObject.joined}}) # joined
|
2014-11-19 00:28:00 +08:00
|
|
|
if voiceUserObject.locked?
|
2014-11-21 06:01:26 +08:00
|
|
|
Meteor.Users.update({meetingId: meetingId ,userId: voiceUserObject.web_userid}, {$set: {'user.voiceUser.locked':voiceUserObject.locked}}) # locked
|
2014-11-19 00:28:00 +08:00
|
|
|
if voiceUserObject.muted?
|
2014-11-21 06:01:26 +08:00
|
|
|
Meteor.Users.update({meetingId: meetingId ,userId: voiceUserObject.web_userid}, {$set: {'user.voiceUser.muted':voiceUserObject.muted}}) # muted
|
2015-04-02 23:07:58 +08:00
|
|
|
if voiceUserObject.listen_only?
|
|
|
|
Meteor.Users.update({meetingId: meetingId ,userId: voiceUserObject.web_userid}, {$set: {'user.listenOnly':voiceUserObject.listen_only}}) # listenOnly
|
2014-11-19 00:28:00 +08:00
|
|
|
else
|
2015-02-07 01:21:31 +08:00
|
|
|
Meteor.log.error "ERROR! did not find such voiceUser!"
|
2014-09-26 02:29:43 +08:00
|
|
|
|
2014-11-21 05:32:51 +08:00
|
|
|
@userJoined = (meetingId, user) ->
|
2014-11-19 00:28:00 +08:00
|
|
|
userId = user.userid
|
2014-11-21 05:32:51 +08:00
|
|
|
|
|
|
|
u = Meteor.Users.findOne({userId:user.userid, meetingId: meetingId})
|
|
|
|
# the collection already contains an entry for this user because
|
|
|
|
# we added a dummy user on register_user_message (to save authToken)
|
|
|
|
if u?
|
2015-04-24 03:55:38 +08:00
|
|
|
Meteor.log.info "UPDATING USER #{user.userid}, authToken=#{u.authToken}, locked=#{user.locked}"
|
2014-11-21 05:32:51 +08:00
|
|
|
Meteor.Users.update({userId:user.userid, meetingId: meetingId}, {$set:{
|
|
|
|
user:
|
|
|
|
userid: user.userid
|
|
|
|
presenter: user.presenter
|
|
|
|
name: user.name
|
2014-12-13 04:58:54 +08:00
|
|
|
_sort_name: user.name.toLowerCase()
|
2014-11-21 05:32:51 +08:00
|
|
|
phone_user: user.phone_user
|
2015-10-06 23:10:38 +08:00
|
|
|
emoji_status: user.emoji_status
|
|
|
|
set_emoji_time: user.set_emoji_time
|
2015-10-02 06:24:43 +08:00
|
|
|
emoji_status: user.emoji_status
|
2014-11-21 05:32:51 +08:00
|
|
|
has_stream: user.has_stream
|
|
|
|
role: user.role
|
|
|
|
listenOnly: user.listenOnly
|
|
|
|
extern_userid: user.extern_userid
|
|
|
|
permissions: user.permissions
|
|
|
|
locked: user.locked
|
|
|
|
time_of_joining: user.timeOfJoining
|
2014-11-22 04:29:07 +08:00
|
|
|
connection_status: "online" # TODO consider other default value
|
2014-11-21 05:32:51 +08:00
|
|
|
voiceUser:
|
|
|
|
web_userid: user.voiceUser.web_userid
|
|
|
|
callernum: user.voiceUser.callernum
|
|
|
|
userid: user.voiceUser.userid
|
|
|
|
talking: user.voiceUser.talking
|
|
|
|
joined: user.voiceUser.joined
|
|
|
|
callername: user.voiceUser.callername
|
|
|
|
locked: user.voiceUser.locked
|
|
|
|
muted: user.voiceUser.muted
|
|
|
|
webcam_stream: user.webcam_stream
|
|
|
|
}})
|
|
|
|
|
2015-04-07 04:00:44 +08:00
|
|
|
# only add the welcome message if it's not there already
|
|
|
|
unless Meteor.Chat.findOne({"message.chat_type":'SYSTEM_MESSAGE', "message.to_userid": userId})?
|
|
|
|
welcomeMessage = Meteor.config.defaultWelcomeMessage
|
|
|
|
.replace /%%CONFNAME%%/, Meteor.Meetings.findOne({meetingId: meetingId})?.meetingName
|
|
|
|
welcomeMessage = welcomeMessage + Meteor.config.defaultWelcomeMessageFooter
|
2014-12-17 08:20:13 +08:00
|
|
|
|
2015-04-07 04:00:44 +08:00
|
|
|
# store the welcome message in chat for easy display on the client side
|
|
|
|
Meteor.Chat.insert(
|
2014-12-17 08:20:13 +08:00
|
|
|
meetingId: meetingId
|
2015-04-03 05:42:35 +08:00
|
|
|
message:
|
|
|
|
chat_type: "SYSTEM_MESSAGE"
|
|
|
|
message: welcomeMessage
|
|
|
|
from_color: '0x3399FF'
|
|
|
|
to_userid: userId
|
|
|
|
from_userid: "SYSTEM_MESSAGE"
|
|
|
|
from_username: ""
|
|
|
|
from_time: user.timeOfJoining?.toString()
|
2015-04-07 04:00:44 +08:00
|
|
|
)
|
|
|
|
Meteor.log.info "added a system message in chat for user #{userId}"
|
2014-12-17 08:20:13 +08:00
|
|
|
|
2014-11-21 05:32:51 +08:00
|
|
|
else
|
|
|
|
# scenario: there are meetings running at the time when the meteor
|
|
|
|
# process starts. As a result we the get_users_reply message contains
|
|
|
|
# users for which we have not observed user_registered_message and
|
|
|
|
# hence we do not have the auth_token. There will be permission issues
|
|
|
|
# as the server collection does not have the auth_token of such users
|
|
|
|
# and cannot authorize their client side actions
|
|
|
|
Meteor.log.info "NOTE: got user_joined_message "
|
2014-11-19 00:28:00 +08:00
|
|
|
entry =
|
|
|
|
meetingId: meetingId
|
|
|
|
userId: userId
|
|
|
|
user:
|
|
|
|
userid: user.userid
|
|
|
|
presenter: user.presenter
|
|
|
|
name: user.name
|
2014-12-13 04:58:54 +08:00
|
|
|
_sort_name: user.name.toLowerCase()
|
2014-11-19 00:28:00 +08:00
|
|
|
phone_user: user.phone_user
|
2015-10-06 23:10:38 +08:00
|
|
|
emoji_status: user.emoji_status
|
|
|
|
set_emoji_time: user.set_emoji_time
|
2014-11-19 00:28:00 +08:00
|
|
|
has_stream: user.has_stream
|
|
|
|
role: user.role
|
|
|
|
listenOnly: user.listenOnly
|
|
|
|
extern_userid: user.extern_userid
|
|
|
|
permissions: user.permissions
|
|
|
|
locked: user.locked
|
|
|
|
time_of_joining: user.timeOfJoining
|
|
|
|
connection_status: "" # TODO consider other default value
|
|
|
|
voiceUser:
|
|
|
|
web_userid: user.voiceUser.web_userid
|
|
|
|
callernum: user.voiceUser.callernum
|
|
|
|
userid: user.voiceUser.userid
|
|
|
|
talking: user.voiceUser.talking
|
|
|
|
joined: user.voiceUser.joined
|
|
|
|
callername: user.voiceUser.callername
|
|
|
|
locked: user.voiceUser.locked
|
|
|
|
muted: user.voiceUser.muted
|
|
|
|
webcam_stream: user.webcam_stream
|
|
|
|
|
|
|
|
id = Meteor.Users.insert(entry)
|
2015-02-07 01:21:31 +08:00
|
|
|
Meteor.log.info "joining user userid=[#{userId}], id=[#{id}]:#{user.name}. Users.size is now #{Meteor.Users.find({meetingId: meetingId}).count()}"
|
2014-11-21 05:32:51 +08:00
|
|
|
|
2015-02-07 01:21:31 +08:00
|
|
|
@createDummyUser = (meetingId, userId, authToken) ->
|
|
|
|
if Meteor.Users.findOne({userId:userId, meetingId: meetingId, authToken:authToken})?
|
|
|
|
Meteor.log.info "html5 user userid:[#{userId}] from [#{meetingId}] tried to revalidate token"
|
2014-11-21 05:32:51 +08:00
|
|
|
else
|
|
|
|
entry =
|
|
|
|
meetingId: meetingId
|
2015-02-07 01:21:31 +08:00
|
|
|
userId: userId
|
|
|
|
authToken: authToken
|
|
|
|
clientType: "HTML5"
|
|
|
|
validated: false #will be validated on validate_auth_token_reply
|
2014-11-21 05:32:51 +08:00
|
|
|
|
|
|
|
id = Meteor.Users.insert(entry)
|
2015-02-07 01:21:31 +08:00
|
|
|
Meteor.log.info "added user dummy html5 user with: userid=[#{userId}], id=[#{id}]
|
2014-11-21 05:32:51 +08:00
|
|
|
Users.size is now #{Meteor.Users.find({meetingId: meetingId}).count()}"
|
2014-12-23 03:43:27 +08:00
|
|
|
|
2015-03-31 01:49:30 +08:00
|
|
|
|
2015-04-24 03:55:38 +08:00
|
|
|
# when new lock settings including disableMic are set,
|
|
|
|
# all viewers that are in the audio bridge with a mic should be muted and locked
|
|
|
|
@handleLockingMic = (meetingId, newSettings) ->
|
|
|
|
# send mute requests for the viewer users joined with mic
|
2015-04-24 04:53:07 +08:00
|
|
|
for u in Meteor.Users.find({
|
|
|
|
meetingId:meetingId
|
|
|
|
'user.role':'VIEWER'
|
|
|
|
'user.listenOnly':false
|
|
|
|
'user.locked':true
|
|
|
|
'user.voiceUser.joined':true
|
|
|
|
'user.voiceUser.muted':false})?.fetch()
|
|
|
|
Meteor.log.error u.user.name #
|
2015-04-24 03:55:38 +08:00
|
|
|
Meteor.call('muteUser', meetingId, u.userId, u.userId, u.authToken, true) #true for muted
|
|
|
|
|
2015-03-31 01:49:30 +08:00
|
|
|
# change the locked status of a user (lock settings)
|
|
|
|
@setUserLockedStatus = (meetingId, userId, isLocked) ->
|
|
|
|
if Meteor.Users.findOne({userId:userId, meetingId: meetingId})?
|
|
|
|
Meteor.Users.update({userId:userId, meetingId: meetingId}, {$set:{'user.locked': isLocked}})
|
2015-04-24 04:53:07 +08:00
|
|
|
|
|
|
|
# if the user is sharing audio, he should be muted upon locking involving disableMic
|
|
|
|
u = Meteor.Users.findOne({meetingId:meetingId, userId:userId})
|
|
|
|
if u.user.role is 'VIEWER' and !u.user.listenOnly and u.user.voiceUser.joined and !u.user.voiceUser.muted and isLocked
|
|
|
|
Meteor.call('muteUser', meetingId, u.userId, u.userId, u.authToken, true) #true for muted
|
|
|
|
|
2015-03-31 01:49:30 +08:00
|
|
|
Meteor.log.info "setting user locked status for userid:[#{userId}] from [#{meetingId}] locked=#{isLocked}"
|
|
|
|
else
|
|
|
|
Meteor.log.error "(unsuccessful-no such user) setting user locked status for userid:[#{userId}] from [#{meetingId}] locked=#{isLocked}"
|
|
|
|
|
|
|
|
|
2014-12-23 03:43:27 +08:00
|
|
|
# called on server start and on meeting end
|
|
|
|
@clearUsersCollection = (meetingId) ->
|
|
|
|
if meetingId?
|
|
|
|
Meteor.Users.remove({meetingId: meetingId}, Meteor.log.info "cleared Users Collection (meetingId: #{meetingId}!")
|
|
|
|
else
|
|
|
|
Meteor.Users.remove({}, Meteor.log.info "cleared Users Collection (all meetings)!")
|