Match our changes on the ActionScript side.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6321 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -26,6 +26,7 @@ import com.threerings.util.Name;
|
|||||||
|
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
import com.threerings.presents.data.InvocationCodes;
|
import com.threerings.presents.data.InvocationCodes;
|
||||||
|
import com.threerings.presents.data.PermissionPolicy;
|
||||||
|
|
||||||
import com.threerings.crowd.chat.data.ChatCodes;
|
import com.threerings.crowd.chat.data.ChatCodes;
|
||||||
|
|
||||||
@@ -193,5 +194,10 @@ public class BodyObject extends ClientObject
|
|||||||
{
|
{
|
||||||
return OccupantInfo.X_STATUS[status];
|
return OccupantInfo.X_STATUS[status];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override protected function createPermissionPolicy () :PermissionPolicy
|
||||||
|
{
|
||||||
|
return new CrowdPermissionPolicy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,9 @@ public class ClientObject extends DObject
|
|||||||
*/
|
*/
|
||||||
public function checkAccess (perm :Permission, context :Object = null) :String
|
public function checkAccess (perm :Permission, context :Object = null) :String
|
||||||
{
|
{
|
||||||
|
if (_permPolicy == null) {
|
||||||
|
_permPolicy = createPermissionPolicy();
|
||||||
|
}
|
||||||
return _permPolicy.checkAccess(this, perm, context);
|
return _permPolicy.checkAccess(this, perm, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,9 +122,13 @@ public class ClientObject extends DObject
|
|||||||
super.readObject(ins);
|
super.readObject(ins);
|
||||||
username = Name(ins.readObject());
|
username = Name(ins.readObject());
|
||||||
receivers = DSet(ins.readObject());
|
receivers = DSet(ins.readObject());
|
||||||
_permPolicy = PermissionPolicy(ins.readObject());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected var _permPolicy :PermissionPolicy;
|
protected function createPermissionPolicy () :PermissionPolicy
|
||||||
|
{
|
||||||
|
return new PermissionPolicy();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected /*transient*/ var _permPolicy :PermissionPolicy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ import com.threerings.io.Streamable;
|
|||||||
/**
|
/**
|
||||||
* Encapsulates a fine-grained permissions policy. The default policy is to deny access to
|
* Encapsulates a fine-grained permissions policy. The default policy is to deny access to
|
||||||
* everything, systems using fine-grained permissions should create a custom policy and provide it
|
* everything, systems using fine-grained permissions should create a custom policy and provide it
|
||||||
* at client resolution time via the ClientResolver.
|
* at client resolution time via the ClientResolver. This would be an inner class of ClientObject,
|
||||||
|
* but ActionScript does not support inner classes.
|
||||||
*/
|
*/
|
||||||
public class PermissionPolicy
|
public class PermissionPolicy
|
||||||
implements Streamable
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns null if the specified client has the specified permission, an error code explaining
|
* Returns null if the specified client has the specified permission, an error code explaining
|
||||||
@@ -43,17 +43,5 @@ public class PermissionPolicy
|
|||||||
// by default, you can't do it!
|
// by default, you can't do it!
|
||||||
return InvocationCodes.ACCESS_DENIED;
|
return InvocationCodes.ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// from interface Streamable
|
|
||||||
public function writeObject (out :ObjectOutputStream) :void
|
|
||||||
{
|
|
||||||
// nothing needed
|
|
||||||
}
|
|
||||||
|
|
||||||
// from interface Streamable
|
|
||||||
public function readObject (ins :ObjectInputStream) :void
|
|
||||||
{
|
|
||||||
// nothing needed
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user