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:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ChatProvider.java,v 1.23 2003/07/01 21:53:02 mdb Exp $
|
||||
// $Id: ChatProvider.java,v 1.24 2003/07/18 01:58:38 eric Exp $
|
||||
|
||||
package com.threerings.crowd.chat.server;
|
||||
|
||||
@@ -57,6 +57,16 @@ public class ChatProvider
|
||||
_autoRespond = autoRespond;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the authorizer we will use to see if the user is allowed to
|
||||
* perform various chatting actions.
|
||||
*/
|
||||
public static void setCommunicationAuthorizer (
|
||||
CommunicationAuthorizer comAuth)
|
||||
{
|
||||
_comAuth = comAuth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the chat services and registers a chat provider with
|
||||
* the invocation manager.
|
||||
@@ -78,6 +88,11 @@ public class ChatProvider
|
||||
TellListener listener)
|
||||
throws InvocationException
|
||||
{
|
||||
// make sure the caller is authorized to perform this action
|
||||
if ((_comAuth != null) && (!_comAuth.authorized(caller))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// make sure the target user is online
|
||||
BodyObject tobj = CrowdServer.lookupBody(target);
|
||||
if (tobj == null) {
|
||||
@@ -165,4 +180,7 @@ public class ChatProvider
|
||||
|
||||
/** Reference to our auto responder object. */
|
||||
protected static TellAutoResponder _autoRespond;
|
||||
|
||||
/** The entity that will authorize our chatters. */
|
||||
protected static CommunicationAuthorizer _comAuth;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user