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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2008 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.presents.data;
|
||||
|
||||
/**
|
||||
* A value class used by {@link ClientObject#checkAccess} to do fine-grained access control.
|
||||
*/
|
||||
public class Permission
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user