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: SpotProvider.java,v 1.18 2003/04/17 19:17:07 mdb Exp $
// $Id: SpotProvider.java,v 1.19 2003/07/18 01:58:38 eric Exp $
package com.threerings.whirled.spot.server;
@@ -11,6 +11,7 @@ import com.threerings.presents.server.InvocationException;
import com.threerings.presents.server.InvocationManager;
import com.threerings.presents.server.InvocationProvider;
import com.threerings.crowd.chat.server.CommunicationAuthorizer;
import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.data.PlaceConfig;
import com.threerings.crowd.data.PlaceObject;
@@ -48,6 +49,16 @@ public class SpotProvider
_omgr = omgr;
}
/**
* 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;
}
/**
* Processes a {@link SpotService#traversePortal} request.
*/
@@ -201,6 +212,11 @@ public class SpotProvider
public void clusterSpeak (ClientObject caller, String message, byte mode)
throws InvocationException
{
// make sure the caller is authorized to perform this action
if ((_comAuth != null) && (!_comAuth.authorized(caller))) {
return;
}
BodyObject source = (BodyObject)caller;
sendClusterChatMessage(getCallerSceneId(caller), source.getOid(),
source.username, null, message, mode);
@@ -269,4 +285,7 @@ public class SpotProvider
/** The object manager we use to do dobject stuff. */
protected RootDObjectManager _omgr;
/** The entity that will authorize our speaker. */
protected static CommunicationAuthorizer _comAuth;
}