locking for public chat

This commit is contained in:
Anton Georgiev 2015-03-30 22:48:25 +00:00
parent b47e8f3330
commit 7b3d6497c2
5 changed files with 37 additions and 17 deletions

View File

@ -113,6 +113,12 @@
padding: 5px; padding: 5px;
} }
.disabledChat {
background-color: grey;
width: 100% !important;
}
.dropdown { .dropdown {
float: left; float: left;
@media @desktop-portrait, @mobile-portrait, @mobile-portrait-with-keyboard { @media @desktop-portrait, @mobile-portrait, @mobile-portrait-with-keyboard {

View File

@ -65,6 +65,14 @@ Handlebars.registerHelper "grabChatTabs", ->
setInSession 'chatTabs', initTabs setInSession 'chatTabs', initTabs
getInSession('chatTabs')[0..3] getInSession('chatTabs')[0..3]
Handlebars.registerHelper "publicChatDisabled", ->
userIsLocked = Meteor.Users.findOne({userId:getInSession 'userId'})?.user.locked
console.log "userIsLocked=" + userIsLocked
publicChatIsDisabled = Meteor.Meetings.findOne({})?.roomLockSettings.disablePubChat
console.log "publicChatIsDisabled=" + publicChatIsDisabled
return userIsLocked and publicChatIsDisabled
@sendMessage = -> @sendMessage = ->
message = linkify $('#newMessageInput').val() # get the message from the input box message = linkify $('#newMessageInput').val() # get the message from the input box
unless (message?.length > 0 and (/\S/.test(message))) # check the message has content and it is not whitespace unless (message?.length > 0 and (/\S/.test(message))) # check the message has content and it is not whitespace

View File

@ -27,12 +27,16 @@
</template> </template>
<template name="chatInput"> <template name="chatInput">
<div id="chatInput" class="chat-input-wrapper"> <div id="chatInput" class="chat-input-wrapper">
<textarea id="newMessageInput" placeholder="Write a message..." rel="tooltip" data-placement="top" title="Write a new message"></textarea> {{#if publicChatDisabled}}
<button type="submit" id="sendMessageButton" class="btn" rel="tooltip" data-placement="top" title="Click to send your message"> <textarea id="newMessageInput" class="disabledChat" placeholder="Public chat is temporarily locked (disabled)" rel="tooltip" data-placement="top" title="Public chat is temporarily locked"></textarea>
Send {{else}}
</button> <textarea id="newMessageInput" placeholder="Write a message..." rel="tooltip" data-placement="top" title="Write a new message"></textarea>
</div> <button type="submit" id="sendMessageButton" class="btn" rel="tooltip" data-placement="top" title="Click to send your message">
Send
</button>
{{/if}}
</div>
</template> </template>
<template name="chatOptions"> <template name="chatOptions">

View File

@ -1,8 +1,4 @@
Meteor.methods Meteor.methods
#
# I dont know if this is okay to be server side. We need to call it from the router, but I don't know if any harm can be caused
# by the client calling this
#
# Construct and send a message to bbb-web to validate the user # Construct and send a message to bbb-web to validate the user
validateAuthToken: (meetingId, userId, authToken) -> validateAuthToken: (meetingId, userId, authToken) ->
@ -70,6 +66,11 @@ class Meteor.RedisPubSub
# "get_users_reply" # "get_users_reply"
"get_chat_history_reply" "get_chat_history_reply"
"get_all_meetings_reply" "get_all_meetings_reply"
"presentation_shared_message"
"presentation_conversion_done_message"
"presentation_conversion_progress_message"
"presentation_page_generated_message"
"presentation_page_changed_message"
] ]
if message?.header? and message?.payload? if message?.header? and message?.payload?
@ -287,8 +288,6 @@ class Meteor.RedisPubSub
return return
if message.header.name is "new_permission_settings" if message.header.name is "new_permission_settings"
console.log "\n22222"
# meetingId = message.payload.meeting_id
# substitute with the new lock settings # substitute with the new lock settings
Meteor.Meetings.update({meetingId: meetingId}, {$set: { Meteor.Meetings.update({meetingId: meetingId}, {$set: {
@ -302,7 +301,6 @@ class Meteor.RedisPubSub
return return
if message.header.name is "user_locked_message" or message.header.name is "user_unlocked_message" if message.header.name is "user_locked_message" or message.header.name is "user_unlocked_message"
console.log "\n33333333"
userId = message.payload.userid userId = message.payload.userid
isLocked = message.payload.locked isLocked = message.payload.locked
setUserLockedStatus(meetingId, userId, isLocked) setUserLockedStatus(meetingId, userId, isLocked)

View File

@ -22,7 +22,7 @@ moderator =
chatPrivate: true #should make this dynamically modifiable later on chatPrivate: true #should make this dynamically modifiable later on
viewer = viewer = (meetingId, userId) ->
# raising/lowering hand # raising/lowering hand
raiseOwnHand : true raiseOwnHand : true
lowerOwnHand : true lowerOwnHand : true
@ -38,12 +38,16 @@ viewer =
subscribeChat: true subscribeChat: true
#chat #chat
chatPublic: true #should make this dynamically modifiable later on chatPublic: !(Meteor.Meetings.findOne({meetingId:meetingId})?.roomLockSettings.disablePubChat) or
chatPrivate: true #should make this dynamically modifiable later on !(Meteor.Users.findOne({meetingId:meetingId, userId:userId})?.user.locked)
chatPrivate: !(Meteor.Meetings.findOne({meetingId:meetingId})?.roomLockSettings.disablePrivChat) or
!(Meteor.Users.findOne({meetingId:meetingId, userId:userId})?.user.locked)
@isAllowedTo = (action, meetingId, userId, authToken) -> @isAllowedTo = (action, meetingId, userId, authToken) ->
# Disclaimer:the current version of the HTML5 client represents only VIEWER users # Disclaimer:the current version of the HTML5 client represents only VIEWER users
Meteor.log.error "#{action} : " + viewer(meetingId, userId)[action]
validated = Meteor.Users.findOne({meetingId:meetingId, userId: userId})?.validated validated = Meteor.Users.findOne({meetingId:meetingId, userId: userId})?.validated
Meteor.log.info "in isAllowedTo: action-#{action}, userId=#{userId}, authToken=#{authToken} validated:#{validated}" Meteor.log.info "in isAllowedTo: action-#{action}, userId=#{userId}, authToken=#{authToken} validated:#{validated}"
@ -52,7 +56,7 @@ viewer =
if user? and authToken is user.authToken # check if the user is who he claims to be 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" if user.validated and user.clientType is "HTML5"
if user.user?.role is 'VIEWER' or user.user?.role is 'MODERATOR' or user.user?.role is undefined if user.user?.role is 'VIEWER' or user.user?.role is 'MODERATOR' or user.user?.role is undefined
return viewer[action] or false return viewer(meetingId)[action] or false
else else
Meteor.log.warn "UNSUCCESSFULL ATTEMPT FROM userid=#{userId} to perform:#{action}" Meteor.log.warn "UNSUCCESSFULL ATTEMPT FROM userid=#{userId} to perform:#{action}"
return false return false