From 9abef6df53c3240a23768049c43ba8aa4108cf88 Mon Sep 17 00:00:00 2001 From: Dave Hoover Date: Fri, 23 May 2008 23:26:12 +0000 Subject: [PATCH] Lots of times we don't care WHY someone lacks access, just that they do; so add convenience wrappers giving us a boolean back instead of forcing us to see if checkAccess(blah) == null. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5132 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/data/ClientObject.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/java/com/threerings/presents/data/ClientObject.java b/src/java/com/threerings/presents/data/ClientObject.java index b386abc8a..0b9fdeb43 100644 --- a/src/java/com/threerings/presents/data/ClientObject.java +++ b/src/java/com/threerings/presents/data/ClientObject.java @@ -80,10 +80,27 @@ public class ClientObject extends DObject { return checkAccess(perm, null); } + + /** + * Convenience wrapper around {@link #checkAccess} that simply returns a boolean indicating + * whether or not this client has the permission rather than an explanation. + */ + public boolean hasAccess (Permission perm, Object context) + { + return checkAccess(perm, context) == null; + } + + /** + * Convenience wrapper around {@link #checkAccess} that simply returns a boolean indicating + * whether or not this client has the permission rather than an explanation. + */ + public boolean hasAccess (Permission perm) + { + return checkAccess(perm) == null; + } /** - * Used for reference counting client objects, adds a reference to - * this object. + * Used for reference counting client objects, adds a reference to this object. */ public synchronized void reference () {