ObjectPermissions in general should deal only with identifiers.

This commit is contained in:
Michael Jumper
2013-01-28 16:50:14 -08:00
committed by Michael Jumper
parent dfca47d415
commit c537e4fe2c
3 changed files with 25 additions and 22 deletions

View File

@@ -53,7 +53,7 @@ public class GuacamoleConfigurationPermission
* The identifier of the GuacamoleConfiguration associated with the * The identifier of the GuacamoleConfiguration associated with the
* operation affected by this permission. * operation affected by this permission.
*/ */
private String subject; private String identifier;
/** /**
* The type of operation affected by this permission. * The type of operation affected by this permission.
@@ -62,22 +62,23 @@ public class GuacamoleConfigurationPermission
/** /**
* Creates a new GuacamoleConfigurationPermission having the given type * Creates a new GuacamoleConfigurationPermission having the given type
* and subject. * and identifier. The identifier must be the unique identifier assigned
* to the GuacamoleConfiguration by the AuthenticationProvider in use.
* *
* @param type The type of operation affected by this permission. * @param type The type of operation affected by this permission.
* @param subject The identifier of the GuacamoleConfiguration associated * @param identifier The identifier of the GuacamoleConfiguration associated
* with the operation affected by this permission. * with the operation affected by this permission.
*/ */
public GuacamoleConfigurationPermission(Type type, String subject) { public GuacamoleConfigurationPermission(Type type, String identifier) {
this.subject = subject; this.identifier = identifier;
this.type = type; this.type = type;
} }
@Override @Override
public String getSubject() { public String getObjectIdentifier() {
return subject; return identifier;
} }
@Override @Override

View File

@@ -43,7 +43,7 @@ package net.sourceforge.guacamole.net.auth.permission;
* whole. * whole.
* *
* @author Michael Jumper * @author Michael Jumper
* @param <T> The type of object this permission affects. * @param <T> The type of identifier used by the object this permission affects.
*/ */
public interface ObjectPermission<T> extends Permission<ObjectPermission.Type> { public interface ObjectPermission<T> extends Permission<ObjectPermission.Type> {
@@ -76,9 +76,12 @@ public interface ObjectPermission<T> extends Permission<ObjectPermission.Type> {
} }
/** /**
* Returns the specific object affected by this permission. * Returns the identifier of the specific object affected by this
* @return The specific object affected by this permission. * permission.
*
* @return The identifier of the specific object affected by this
* permission.
*/ */
public T getSubject(); public T getObjectIdentifier();
} }

View File

@@ -37,8 +37,6 @@ package net.sourceforge.guacamole.net.auth.permission;
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
import net.sourceforge.guacamole.net.auth.User;
/** /**
* A permission which controls operations that directly affect a specific * A permission which controls operations that directly affect a specific
@@ -52,7 +50,7 @@ public class UserPermission implements ObjectPermission<String> {
* The username of the User associated with the operation affected by this * The username of the User associated with the operation affected by this
* permission. * permission.
*/ */
private String subject; private String identifier;
/** /**
* The type of operation affected by this permission. * The type of operation affected by this permission.
@@ -60,22 +58,23 @@ public class UserPermission implements ObjectPermission<String> {
private Type type; private Type type;
/** /**
* Creates a new UserPermission having the given type and subject. * Creates a new UserPermission having the given type and identifier. The
* identifier must be the user's username.
* *
* @param type The type of operation affected by this permission. * @param type The type of operation affected by this permission.
* @param subject The username of the User associated with the operation * @param identifier The username of the User associated with the operation
* affected by this permission. * affected by this permission.
*/ */
public UserPermission(String subject, Type type) { public UserPermission(String identifier, Type type) {
this.subject = subject; this.identifier = identifier;
this.type = type; this.type = type;
} }
@Override @Override
public String getSubject() { public String getObjectIdentifier() {
return subject; return identifier;
} }
@Override @Override