Slap the CommunicationAuthorizer code in such that we block all user

communication if the user is not authorized.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2715 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Eric Lundberg
2003-07-18 01:58:38 +00:00
parent c2a5e8966b
commit 957faac149
3 changed files with 58 additions and 3 deletions
@@ -1,5 +1,5 @@
//
// $Id: SpeakProvider.java,v 1.14 2003/07/14 23:46:03 ray Exp $
// $Id: SpeakProvider.java,v 1.15 2003/07/18 01:58:38 eric Exp $
package com.threerings.crowd.chat.server;
@@ -62,11 +62,26 @@ public class SpeakProvider
_validator = validator;
}
/**
* Set the authorizer we will use to see if the user is allowed to
* perform various speaking actions.
*/
public static void setCommunicationAuthorizer (
CommunicationAuthorizer comAuth)
{
_comAuth = comAuth;
}
/**
* Handles a {@link SpeakService#speak} request.
*/
public void speak (ClientObject caller, String message, byte mode)
{
// make sure the caller is authorized to perform this action
if ((_comAuth != null) && (!_comAuth.authorized(caller))) {
return;
}
// ensure that the speaker is valid
// TODO: broadcast should be handled more like a system message
// rather than as a mode for a user message so that we don't
@@ -327,6 +342,9 @@ public class SpeakProvider
/** The entity that will validate our speakers. */
protected SpeakerValidator _validator;
/** The entity that will authorize our speakers. */
protected static CommunicationAuthorizer _comAuth;
/** Recent chat history for the server. */
protected static HashMap _histories = new HashMap();