Further refinement of the permissions system. Eliminated the

CommunicationAuthorizer and rolled that into the BodyObject-based
permissions system. A victory for consolidation and elegance.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3380 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2005-03-03 04:47:57 +00:00
parent bc837ca289
commit c2e2661e66
6 changed files with 45 additions and 93 deletions
@@ -29,7 +29,7 @@ import com.threerings.presents.dobj.RootDObjectManager;
import com.threerings.presents.server.InvocationException;
import com.threerings.presents.server.InvocationProvider;
import com.threerings.crowd.chat.server.CommunicationAuthorizer;
import com.threerings.crowd.chat.data.ChatCodes;
import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.server.PlaceRegistry;
@@ -64,16 +64,6 @@ 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.
*/
@@ -250,12 +240,13 @@ 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;
// ensure the caller has normal chat access
BodyObject source = (BodyObject)caller;
String errmsg = source.checkAccess(ChatCodes.CHAT_ACCESS, null);
if (errmsg != null) {
throw new InvocationException(errmsg);
}
BodyObject source = (BodyObject)caller;
sendClusterChatMessage(getCallerSceneId(caller), source.getOid(),
source.username, null, message, mode);
}
@@ -323,7 +314,4 @@ 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;
}