bigbluebutton-Github/labs/meteor-client/app/server/user_permissions.coffee

33 lines
905 B
CoffeeScript
Raw Normal View History

# 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
# 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
@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
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