2014-11-15 00:00:55 +08:00
|
|
|
# TODO we should look into publishing the Users collection so that includes
|
|
|
|
# the secret of the specific user but not of the other users
|
|
|
|
|
|
|
|
moderator = null
|
|
|
|
presenter = null
|
|
|
|
viewer =
|
|
|
|
# raising/lowering hand
|
|
|
|
raiseOwnHand : true
|
|
|
|
lowerOwnHand : true
|
|
|
|
|
2014-11-19 03:35:51 +08:00
|
|
|
# muting
|
|
|
|
muteSelf : true
|
|
|
|
unmuteSelf : true
|
|
|
|
|
2014-11-19 06:03:13 +08:00
|
|
|
logoutSelf : true
|
|
|
|
|
2014-11-21 07:35:30 +08:00
|
|
|
#subscribing
|
|
|
|
subscribeUsers: true
|
|
|
|
subscribeChat: true
|
|
|
|
|
2014-11-15 00:00:55 +08:00
|
|
|
@isAllowedTo = (action, meetingId, userId, secret) ->
|
|
|
|
|
|
|
|
user = Meteor.Users.findOne({meetingId:meetingId, userId: userId})
|
|
|
|
if user?
|
|
|
|
# we check if the user is who he claims to be
|
2014-11-21 07:35:30 +08:00
|
|
|
if secret is user.authToken
|
2014-11-15 00:00:55 +08:00
|
|
|
if user.user?.role is 'VIEWER'
|
|
|
|
return viewer[action] or false
|
|
|
|
Meteor.log.info "in meetingId=#{meetingId} userId=#{userId} tried to perform #{action} without permission" #TODO make this a warning
|
|
|
|
|
|
|
|
# the current version of the HTML5 client represents only VIEWER users
|
|
|
|
return false
|