diff --git a/src/as/com/threerings/bureau/client/BureauDirector.as b/src/as/com/threerings/bureau/client/BureauDirector.as index 8649c8d2c..9a2861ce0 100644 --- a/src/as/com/threerings/bureau/client/BureauDirector.as +++ b/src/as/com/threerings/bureau/client/BureauDirector.as @@ -6,13 +6,13 @@ import com.threerings.util.Log; import com.threerings.presents.client.BasicDirector; import com.threerings.presents.client.Client; import com.threerings.presents.client.ClientEvent; -import com.threerings.presents.data.ClientObject; import com.threerings.presents.dobj.ObjectAccessError; import com.threerings.presents.dobj.Subscriber; import com.threerings.presents.dobj.SubscriberAdapter; import com.threerings.presents.util.SafeSubscriber; import com.threerings.bureau.data.AgentObject; +import com.threerings.bureau.data.BureauClientObject; import com.threerings.bureau.data.BureauCodes; import com.threerings.bureau.util.BureauContext; @@ -22,6 +22,8 @@ import com.threerings.bureau.util.BureauContext; */ public class BureauDirector extends BasicDirector { + BureauClientObject; + /** * Creates a new BureauDirector. */ diff --git a/src/as/com/threerings/bureau/data/BureauClientObject.as b/src/as/com/threerings/bureau/data/BureauClientObject.as index f82fb3cb1..bf600bf59 100644 --- a/src/as/com/threerings/bureau/data/BureauClientObject.as +++ b/src/as/com/threerings/bureau/data/BureauClientObject.as @@ -21,13 +21,12 @@ package com.threerings.bureau.data { -import com.threerings.presents.dobj.DObject; +import com.threerings.presents.data.ClientObject; /** - * Defines the fields available for the distributed part of a bureau. + * An object representing a Bureau connection. This is currently just a marker class. */ -public class BureauClientObject extends DObject +public class BureauClientObject extends ClientObject { - // TODO: add some fields } } diff --git a/src/java/com/threerings/bureau/data/BureauClientObject.java b/src/java/com/threerings/bureau/data/BureauClientObject.java new file mode 100644 index 000000000..316f1421c --- /dev/null +++ b/src/java/com/threerings/bureau/data/BureauClientObject.java @@ -0,0 +1,36 @@ +// +// $Id: $ +// +// Narya library - tools for developing networked games +// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved +// http://www.threerings.net/code/narya/ +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +package com.threerings.bureau.data; + +import com.threerings.presents.data.ClientObject; + +/** + * An object representing a Bureau connection. This is currently just a marker class. + */ +public class BureauClientObject extends ClientObject +{ + @Override + public String toString () + { + return "BUREAU_CLIENT_OBJECT(" + super.toString() + ")"; + } +} diff --git a/src/java/com/threerings/bureau/server/BureauClientResolver.java b/src/java/com/threerings/bureau/server/BureauClientResolver.java new file mode 100644 index 000000000..36f1aa5a8 --- /dev/null +++ b/src/java/com/threerings/bureau/server/BureauClientResolver.java @@ -0,0 +1,39 @@ +// +// $Id: $ +// +// Narya library - tools for developing networked games +// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved +// http://www.threerings.net/code/narya/ +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +package com.threerings.bureau.server; + +import com.threerings.presents.data.ClientObject; +import com.threerings.presents.server.ClientResolver; + +import com.threerings.bureau.data.BureauClientObject; + +/** + * Used to configure crowd-specific client object data. + */ +public class BureauClientResolver extends ClientResolver +{ + @Override // from ClientResolver + public ClientObject createClientObject () + { + return new BureauClientObject(); + } +} diff --git a/src/java/com/threerings/bureau/server/BureauSessionFactory.java b/src/java/com/threerings/bureau/server/BureauSessionFactory.java index eea391340..64a086dc4 100644 --- a/src/java/com/threerings/bureau/server/BureauSessionFactory.java +++ b/src/java/com/threerings/bureau/server/BureauSessionFactory.java @@ -58,10 +58,8 @@ public class BureauSessionFactory implements SessionFactory // from interface SessionFactory public Class getClientResolverClass (Name username) { - // Just give bureaus a vanilla ClientResolver for now. - // TODO: will bureaus need specific resolution? if (BureauCredentials.isBureau(username)) { - return ClientResolver.class; + return BureauClientResolver.class; } else { return _delegate.getClientResolverClass(username); } diff --git a/src/java/com/threerings/crowd/server/CrowdObjectAccess.java b/src/java/com/threerings/crowd/server/CrowdObjectAccess.java index ab8291827..d91ea7d62 100644 --- a/src/java/com/threerings/crowd/server/CrowdObjectAccess.java +++ b/src/java/com/threerings/crowd/server/CrowdObjectAccess.java @@ -29,6 +29,7 @@ import com.threerings.presents.dobj.ProxySubscriber; import com.threerings.presents.dobj.Subscriber; import com.threerings.presents.server.PresentsObjectAccess; +import com.threerings.bureau.data.BureauClientObject; import com.threerings.crowd.data.PlaceObject; /** @@ -59,4 +60,23 @@ public class CrowdObjectAccess return PresentsObjectAccess.DEFAULT.allowDispatch(object, event); } }; + + /** + * Extends the access control in {@link #PLACE} to allow Bureau clients to subscribe. + */ + public static AccessController BUREAU_ACCESS_PLACE = new AccessController() { + public boolean allowSubscribe (DObject object, Subscriber sub) { + if (sub instanceof ProxySubscriber) { + ClientObject co = ((ProxySubscriber)sub).getClientObject(); + if (co instanceof BureauClientObject) { + return true; + } + } + return PLACE.allowSubscribe(object, sub); + } + public boolean allowDispatch (DObject object, DEvent event) { + return PLACE.allowDispatch(object, event); + } + }; + } diff --git a/src/java/com/threerings/presents/server/PresentsSession.java b/src/java/com/threerings/presents/server/PresentsSession.java index d10e1fc69..23b73a715 100644 --- a/src/java/com/threerings/presents/server/PresentsSession.java +++ b/src/java/com/threerings/presents/server/PresentsSession.java @@ -619,6 +619,7 @@ public class PresentsSession protected void sessionWillStart () { // configure a specific access controller for the client object + log.info("Setting access controller to PresentsObjectAccess.CLIENT"); _clobj.setAccessController(PresentsObjectAccess.CLIENT); }