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
@@ -23,11 +23,37 @@ package com.threerings.presents.server;
import com.threerings.util.MessageBundle;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.data.Permission;
/**
* Used to report failures when executing service requests.
*/
public class InvocationException extends Exception
{
/**
* Requires that the specified client have the specified permissions.
*
* @throws InvocationException if they do not.
*/
public static void requireAccess (ClientObject clobj, Permission perm, Object context)
throws InvocationException
{
String errmsg = clobj.checkAccess(perm, context);
if (errmsg != null) {
throw new InvocationException(errmsg);
}
}
/**
* A version of {@link #requireAccess} that takes no context.
*/
public static void requireAccess (ClientObject clobj, Permission perm)
throws InvocationException
{
requireAccess(clobj, perm);
}
/**
* Constructs an invocation exception with the supplied cause code
* string.