2014-11-15 00:00:55 +08:00
|
|
|
|
|
|
|
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-27 06:49:21 +08:00
|
|
|
#chat
|
|
|
|
chatPublic: true #should make this dynamically modifiable later on
|
|
|
|
chatPrivate: true #should make this dynamically modifiable later on
|
|
|
|
|
2014-11-22 01:45:44 +08:00
|
|
|
@isAllowedTo = (action, meetingId, userId, authToken) ->
|
2015-02-14 08:14:49 +08:00
|
|
|
# Disclaimer:the current version of the HTML5 client represents only VIEWER users
|
|
|
|
|
2015-02-07 01:21:31 +08:00
|
|
|
validated = Meteor.Users.findOne({meetingId:meetingId, userId: userId})?.validated
|
|
|
|
Meteor.log.info "in isAllowedTo: action-#{action}, userId=#{userId}, authToken=#{authToken} validated:#{validated}"
|
2014-11-15 00:00:55 +08:00
|
|
|
|
|
|
|
user = Meteor.Users.findOne({meetingId:meetingId, userId: userId})
|
2015-02-14 08:14:49 +08:00
|
|
|
|
|
|
|
if user? and authToken is user.authToken # check if the user is who he claims to be
|
|
|
|
if user.validated and user.clientType is "HTML5"
|
2014-12-10 06:10:06 +08:00
|
|
|
if user.user?.role is 'VIEWER' or user.user?.role is undefined
|
2014-11-15 00:00:55 +08:00
|
|
|
return viewer[action] or false
|
2015-02-14 08:14:49 +08:00
|
|
|
else
|
|
|
|
Meteor.log.warn "UNSUCCESSFULL ATTEMPT FROM userid=#{userId} to perform:#{action}"
|
|
|
|
return false
|
|
|
|
else
|
|
|
|
# user was not validated
|
|
|
|
if action is "logoutSelf"
|
|
|
|
# on unsuccessful sign-in
|
|
|
|
Meteor.log.warn "a user was successfully removed from the meeting following an unsuccessful login"
|
|
|
|
return true
|
|
|
|
return false
|
2014-11-15 00:00:55 +08:00
|
|
|
|
2015-02-07 01:21:31 +08:00
|
|
|
else
|
2015-02-14 08:14:49 +08:00
|
|
|
Meteor.log.error "in meetingId=#{meetingId} userId=#{userId} tried to perform #{action} without permission" +
|
|
|
|
"\n..while the authToken was #{user.authToken} and the user's object is #{JSON.stringify user}"
|
|
|
|
return false
|