Cleaned up the fine-grained permissions system a bit so that Yohoho can make

use of it in good conscience.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5117 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-05-22 12:03:30 +00:00
parent 74791b0493
commit 86dd4d75c7
9 changed files with 130 additions and 56 deletions
@@ -27,10 +27,8 @@ import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.DSet;
/**
* Every client in the system has an associated client object to which
* only they subscribe. The client object can be used to deliver messages
* solely to a particular client as well as to publish client-specific
* data.
* A distributed object to which only the client subscribes. Used to deliver messages solely to a
* particular client as well as to publish client-specific data.
*/
public class ClientObject extends DObject
{
@@ -39,14 +37,12 @@ public class ClientObject extends DObject
public static final String RECEIVERS = "receivers";
// AUTO-GENERATED: FIELDS END
/** The name of a message event delivered to the client when they
* switch usernames (and therefore user objects). */
/** The name of a message event delivered to the client when they switch usernames (and
* therefore user objects). */
public static final String CLOBJ_CHANGED = "!clobj_changed!";
/** Used to publish all invocation service receivers registered on
* this client. */
public DSet<InvocationReceiver.Registration> receivers =
new DSet<InvocationReceiver.Registration>();
/** Used to publish all invocation service receivers registered on this client. */
public DSet<InvocationReceiver.Registration> receivers = DSet.newDSet();
/**
* Returns a short string identifying this client.
@@ -56,6 +52,27 @@ public class ClientObject extends DObject
return "(" + getOid() + ")";
}
/**
* Checks whether or not this client has access to the specified feature. Forms the basis of an
* extensible fine-grained permissions system.
*
* @return null if the user has access, a fully-qualified translatable message string
* indicating the reason for denial of access (or just {@link InvocationCodes#ACCESS_DENIED} if
* you don't want to be specific).
*/
public String checkAccess (Permission feature, Object context)
{
return InvocationCodes.ACCESS_DENIED;
}
/**
* A version of {@link #checkAccess(Permission,Object} that provides no context.
*/
public String checkAccess (Permission feature)
{
return checkAccess(feature, null);
}
/**
* Used for reference counting client objects, adds a reference to
* this object.
@@ -81,9 +98,6 @@ public class ClientObject extends DObject
return (--_references > 0);
}
/** Used to reference count resolved client objects. */
protected transient int _references;
// AUTO-GENERATED: METHODS START
/**
* Requests that the specified entry be added to the
@@ -133,4 +147,7 @@ public class ClientObject extends DObject
this.receivers = clone;
}
// AUTO-GENERATED: METHODS END
/** Used to reference count resolved client objects. */
protected transient int _references;
}