Added permissions for viewers and a presenter. Viewers can't retreive the total number of votes. Also, viewers can't retreive any data if they have voted already

This commit is contained in:
Oleksandr Zhurbenko 2015-07-27 15:55:29 -07:00
parent 4288fd19b8
commit 10be3d03e0
3 changed files with 12 additions and 6 deletions

View File

@ -21,8 +21,8 @@
@clearPollCollection = (meetingId, poll_id) -> @clearPollCollection = (meetingId, poll_id) ->
if meetingId? and poll_id? and Meteor.Polls.findOne({"poll_info.meetingId": meetingId, "poll_info.poll.id": poll_id})? if meetingId? and poll_id? and Meteor.Polls.findOne({"poll_info.meetingId": meetingId, "poll_info.poll.id": poll_id})?
Meteor.Polls.remove({ Meteor.Polls.remove({
"poll_info.meetingId": meetingId, "poll_info.meetingId": meetingId,
"poll_info.poll.id": poll_id}, "poll_info.poll.id": poll_id},
Meteor.log.info "cleared Polls Collection (meetingId: #{meetingId}!") Meteor.log.info "cleared Polls Collection (meetingId: #{meetingId}!")
else else
Meteor.Polls.remove({}, Meteor.log.info "cleared Polls Collection (all meetings)!") Meteor.Polls.remove({}, Meteor.log.info "cleared Polls Collection (all meetings)!")

View File

@ -58,8 +58,12 @@ Meteor.publish 'chat', (meetingId, userid, authToken) ->
Meteor.publish 'bbb_poll', (meetingId, userid, authToken) -> Meteor.publish 'bbb_poll', (meetingId, userid, authToken) ->
if isAllowedTo('subscribePoll', meetingId, userid, authToken) if isAllowedTo('subscribePoll', meetingId, userid, authToken)
Meteor.log.info "publishing Poll for #{meetingId} #{userid} #{authToken}" if isAllowedTo('subscribeAnswers', meetingId, userid, authToken)
return Meteor.Polls.find() Meteor.log.info "publishing Poll for #{meetingId} #{userid} #{authToken}"
return Meteor.Polls.find({"poll_info.meetingId": meetingId, "poll_info.users": userid})
else
return Meteor.Polls.find({"poll_info.meetingId": meetingId, "poll_info.users": userid},
{fields: {"poll_info.poll.answers.number": 0}})
else else
@error new Meteor.Error(402, "The user was not authorized to subscribe for 'bbb_poll'") @error new Meteor.Error(402, "The user was not authorized to subscribe for 'bbb_poll'")
return return

View File

@ -4,7 +4,7 @@ presenter =
#poll #poll
subscribePoll: true subscribePoll: true
subscribeAnswers: true
# holds the values for whether the moderator user is allowed to perform an action (true) # holds the values for whether the moderator user is allowed to perform an action (true)
# or false if not allowed. Some actions have dynamic values depending on the current lock settings # or false if not allowed. Some actions have dynamic values depending on the current lock settings
moderator = moderator =
@ -35,6 +35,7 @@ moderator =
#poll #poll
subscribePoll: true subscribePoll: true
subscribeAnswers: false
# holds the values for whether the viewer user is allowed to perform an action (true) # holds the values for whether the viewer user is allowed to perform an action (true)
@ -73,6 +74,7 @@ viewer = (meetingId, userId) ->
#poll #poll
subscribePoll: true subscribePoll: true
subscribeAnswers: false
# carries out the decision making for actions affecting users. For the list of # carries out the decision making for actions affecting users. For the list of
# actions and the default value - see 'viewer' and 'moderator' in the beginning of the file # actions and the default value - see 'viewer' and 'moderator' in the beginning of the file