mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Merge pull request #188 from glyptodon/object-attribute
GUAC-800: Add API support for arbitrary object-level attributes.
This commit is contained in:
@@ -24,7 +24,9 @@ package org.glyptodon.guacamole.auth.jdbc.connection;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.glyptodon.guacamole.auth.jdbc.tunnel.GuacamoleTunnelService;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.auth.jdbc.base.ModeledGroupedDirectoryObject;
|
||||
@@ -123,4 +125,14 @@ public class ModeledConnection extends ModeledGroupedDirectoryObject<ConnectionM
|
||||
return tunnelService.getActiveConnections(this).size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
return Collections.<String, String>emptyMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
// Drop all attributes - none currently supported
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,6 +23,8 @@
|
||||
package org.glyptodon.guacamole.auth.jdbc.connectiongroup;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.glyptodon.guacamole.auth.jdbc.connection.ConnectionService;
|
||||
import org.glyptodon.guacamole.auth.jdbc.tunnel.GuacamoleTunnelService;
|
||||
@@ -108,4 +110,14 @@ public class ModeledConnectionGroup extends ModeledGroupedDirectoryObject<Connec
|
||||
return connectionGroupService.getIdentifiersWithin(getCurrentUser(), getIdentifier());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
return Collections.<String, String>emptyMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
// Drop all attributes - none currently supported
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,6 +23,8 @@
|
||||
package org.glyptodon.guacamole.auth.jdbc.connectiongroup;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.glyptodon.guacamole.auth.jdbc.connection.ConnectionService;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
@@ -135,4 +137,14 @@ public class RootConnectionGroup extends RestrictedObject
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
return Collections.<String, String>emptyMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
throw new UnsupportedOperationException("The root connection group cannot be modified.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,6 +23,8 @@
|
||||
package org.glyptodon.guacamole.auth.jdbc.user;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import org.glyptodon.guacamole.auth.jdbc.base.ModeledDirectoryObject;
|
||||
import org.glyptodon.guacamole.auth.jdbc.security.PasswordEncryptionService;
|
||||
import org.glyptodon.guacamole.auth.jdbc.security.SaltService;
|
||||
@@ -179,4 +181,14 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
|
||||
return userPermissionService.getPermissionSet(getCurrentUser(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
return Collections.<String, String>emptyMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
// Drop all attributes - none currently supported
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -28,9 +28,12 @@ import org.glyptodon.guacamole.auth.jdbc.connectiongroup.ConnectionGroupDirector
|
||||
import org.glyptodon.guacamole.auth.jdbc.connection.ConnectionDirectory;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.auth.jdbc.base.RestrictedObject;
|
||||
import org.glyptodon.guacamole.auth.jdbc.activeconnection.ActiveConnectionDirectory;
|
||||
import org.glyptodon.guacamole.form.Parameter;
|
||||
import org.glyptodon.guacamole.net.auth.ActiveConnection;
|
||||
import org.glyptodon.guacamole.net.auth.Connection;
|
||||
import org.glyptodon.guacamole.net.auth.ConnectionGroup;
|
||||
@@ -130,4 +133,19 @@ public class UserContext extends RestrictedObject
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Parameter> getUserAttributes() {
|
||||
return Collections.<Parameter>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Parameter> getConnectionAttributes() {
|
||||
return Collections.<Parameter>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Parameter> getConnectionGroupAttributes() {
|
||||
return Collections.<Parameter>emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@
|
||||
package org.glyptodon.guacamole.net.auth;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.protocol.GuacamoleConfiguration;
|
||||
|
||||
@@ -84,6 +85,25 @@ public interface Connection extends Identifiable, Connectable {
|
||||
*/
|
||||
public void setConfiguration(GuacamoleConfiguration config);
|
||||
|
||||
/**
|
||||
* Returns all attributes associated with this connection.
|
||||
*
|
||||
* @return
|
||||
* A map of all attribute identifiers to their corresponding values,
|
||||
* for all attributes associated with this connection.
|
||||
*/
|
||||
Map<String, String> getAttributes();
|
||||
|
||||
/**
|
||||
* Replaces all attributes associated with this connection with the
|
||||
* attributes in the given map.
|
||||
*
|
||||
* @param attributes
|
||||
* A map of all attribute identifiers to their corresponding values,
|
||||
* for all attributes associated with this connection.
|
||||
*/
|
||||
void setAttributes(Map<String, String> attributes);
|
||||
|
||||
/**
|
||||
* Returns a list of ConnectionRecords representing the usage history
|
||||
* of this Connection, including any active users. ConnectionRecords
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
package org.glyptodon.guacamole.net.auth;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
|
||||
@@ -128,4 +129,23 @@ public interface ConnectionGroup extends Identifiable, Connectable {
|
||||
public Set<String> getConnectionGroupIdentifiers()
|
||||
throws GuacamoleException;
|
||||
|
||||
/**
|
||||
* Returns all attributes associated with this connection group.
|
||||
*
|
||||
* @return
|
||||
* A map of all attribute identifiers to their corresponding values,
|
||||
* for all attributes associated with this connection group.
|
||||
*/
|
||||
Map<String, String> getAttributes();
|
||||
|
||||
/**
|
||||
* Replaces all attributes associated with this connection group with the
|
||||
* attributes in the given map.
|
||||
*
|
||||
* @param attributes
|
||||
* A map of all attribute identifiers to their corresponding values,
|
||||
* for all attributes associated with this connection group.
|
||||
*/
|
||||
void setAttributes(Map<String, String> attributes);
|
||||
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
package org.glyptodon.guacamole.net.auth;
|
||||
|
||||
import java.util.Map;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.net.auth.permission.ObjectPermissionSet;
|
||||
import org.glyptodon.guacamole.net.auth.permission.SystemPermissionSet;
|
||||
@@ -51,6 +52,25 @@ public interface User extends Identifiable {
|
||||
*/
|
||||
public void setPassword(String password);
|
||||
|
||||
/**
|
||||
* Returns all attributes associated with this user.
|
||||
*
|
||||
* @return
|
||||
* A map of all attribute identifiers to their corresponding values,
|
||||
* for all attributes associated with this user.
|
||||
*/
|
||||
Map<String, String> getAttributes();
|
||||
|
||||
/**
|
||||
* Replaces all attributes associated with this user with the attributes in
|
||||
* the given map.
|
||||
*
|
||||
* @param attributes
|
||||
* A map of all attribute identifiers to their corresponding values,
|
||||
* for all attributes associated with this user.
|
||||
*/
|
||||
void setAttributes(Map<String, String> attributes);
|
||||
|
||||
/**
|
||||
* Returns all system-level permissions given to this user.
|
||||
*
|
||||
|
@@ -22,7 +22,9 @@
|
||||
|
||||
package org.glyptodon.guacamole.net.auth;
|
||||
|
||||
import java.util.Collection;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.form.Parameter;
|
||||
|
||||
/**
|
||||
* The context of an active user. The functions of this class enforce all
|
||||
@@ -110,4 +112,37 @@ public interface UserContext {
|
||||
*/
|
||||
ConnectionGroup getRootConnectionGroup() throws GuacamoleException;
|
||||
|
||||
/**
|
||||
* Retrieves a collection of all attributes applicable to users. This
|
||||
* collection will contain only those attributes which the current user has
|
||||
* general permission to view or modify. If there are no such attributes,
|
||||
* this collection will be empty.
|
||||
*
|
||||
* @return
|
||||
* A collection of all attributes applicable to users.
|
||||
*/
|
||||
Collection<Parameter> getUserAttributes();
|
||||
|
||||
/**
|
||||
* Retrieves a collection of all attributes applicable to connections. This
|
||||
* collection will contain only those attributes which the current user has
|
||||
* general permission to view or modify. If there are no such attributes,
|
||||
* this collection will be empty.
|
||||
*
|
||||
* @return
|
||||
* A collection of all attributes applicable to connections.
|
||||
*/
|
||||
Collection<Parameter> getConnectionAttributes();
|
||||
|
||||
/**
|
||||
* Retrieves a collection of all attributes applicable to connection
|
||||
* groups. This collection will contain only those attributes which the
|
||||
* current user has general permission to view or modify. If there are no
|
||||
* such attributes, this collection will be empty.
|
||||
*
|
||||
* @return
|
||||
* A collection of all attributes applicable to connection groups.
|
||||
*/
|
||||
Collection<Parameter> getConnectionGroupAttributes();
|
||||
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ package org.glyptodon.guacamole.net.auth.simple;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.environment.Environment;
|
||||
import org.glyptodon.guacamole.environment.LocalEnvironment;
|
||||
@@ -97,6 +98,16 @@ public class SimpleConnection extends AbstractConnection {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
return Collections.<String, String>emptyMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
// Do nothing - there are no attributes
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuacamoleTunnel connect(GuacamoleClientInformation info)
|
||||
throws GuacamoleException {
|
||||
|
@@ -23,7 +23,9 @@
|
||||
package org.glyptodon.guacamole.net.auth.simple;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.GuacamoleSecurityException;
|
||||
@@ -101,6 +103,16 @@ public class SimpleConnectionGroup extends AbstractConnectionGroup {
|
||||
return connectionGroupIdentifiers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
return Collections.<String, String>emptyMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
// Do nothing - there are no attributes
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuacamoleTunnel connect(GuacamoleClientInformation info)
|
||||
throws GuacamoleException {
|
||||
|
@@ -23,9 +23,12 @@
|
||||
package org.glyptodon.guacamole.net.auth.simple;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.GuacamoleSecurityException;
|
||||
import org.glyptodon.guacamole.net.auth.AbstractUser;
|
||||
import org.glyptodon.guacamole.net.auth.permission.ObjectPermission;
|
||||
import org.glyptodon.guacamole.net.auth.permission.ObjectPermissionSet;
|
||||
@@ -106,6 +109,16 @@ public class SimpleUser extends AbstractUser {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
return Collections.<String, String>emptyMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
// Do nothing - there are no attributes
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemPermissionSet getSystemPermissions()
|
||||
throws GuacamoleException {
|
||||
|
@@ -28,6 +28,7 @@ import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.form.Parameter;
|
||||
import org.glyptodon.guacamole.net.auth.ActiveConnection;
|
||||
import org.glyptodon.guacamole.net.auth.Connection;
|
||||
import org.glyptodon.guacamole.net.auth.ConnectionGroup;
|
||||
@@ -174,4 +175,19 @@ public class SimpleUserContext implements UserContext {
|
||||
return new SimpleDirectory<ActiveConnection>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Parameter> getUserAttributes() {
|
||||
return Collections.<Parameter>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Parameter> getConnectionAttributes() {
|
||||
return Collections.<Parameter>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Parameter> getConnectionGroupAttributes() {
|
||||
return Collections.<Parameter>emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -31,9 +31,9 @@ import org.glyptodon.guacamole.net.basic.rest.auth.TokenRESTService;
|
||||
import org.glyptodon.guacamole.net.basic.rest.clipboard.ClipboardRESTService;
|
||||
import org.glyptodon.guacamole.net.basic.rest.connection.ConnectionRESTService;
|
||||
import org.glyptodon.guacamole.net.basic.rest.connectiongroup.ConnectionGroupRESTService;
|
||||
import org.glyptodon.guacamole.net.basic.rest.protocol.ProtocolRESTService;
|
||||
import org.glyptodon.guacamole.net.basic.rest.activeconnection.ActiveConnectionRESTService;
|
||||
import org.glyptodon.guacamole.net.basic.rest.language.LanguageRESTService;
|
||||
import org.glyptodon.guacamole.net.basic.rest.schema.SchemaRESTService;
|
||||
import org.glyptodon.guacamole.net.basic.rest.user.UserRESTService;
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ public class RESTServletModule extends ServletModule {
|
||||
bind(ConnectionGroupRESTService.class);
|
||||
bind(ConnectionRESTService.class);
|
||||
bind(LanguageRESTService.class);
|
||||
bind(ProtocolRESTService.class);
|
||||
bind(SchemaRESTService.class);
|
||||
bind(TokenRESTService.class);
|
||||
bind(UserRESTService.class);
|
||||
|
||||
|
@@ -24,6 +24,7 @@ package org.glyptodon.guacamole.net.basic.rest.connection;
|
||||
|
||||
import java.util.Map;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.net.auth.Connection;
|
||||
import org.glyptodon.guacamole.protocol.GuacamoleConfiguration;
|
||||
@@ -34,6 +35,7 @@ import org.glyptodon.guacamole.protocol.GuacamoleConfiguration;
|
||||
* @author James Muehlner
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
|
||||
public class APIConnection {
|
||||
|
||||
/**
|
||||
@@ -61,6 +63,11 @@ public class APIConnection {
|
||||
*/
|
||||
private Map<String, String> parameters;
|
||||
|
||||
/**
|
||||
* Map of all associated attributes by attribute identifier.
|
||||
*/
|
||||
private Map<String, String> attributes;
|
||||
|
||||
/**
|
||||
* The count of currently active connections using this connection.
|
||||
*/
|
||||
@@ -92,6 +99,9 @@ public class APIConnection {
|
||||
GuacamoleConfiguration configuration = connection.getConfiguration();
|
||||
this.protocol = configuration.getProtocol();
|
||||
|
||||
// Associate any attributes
|
||||
this.attributes = connection.getAttributes();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,4 +206,28 @@ public class APIConnection {
|
||||
this.activeConnections = activeConnections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of all attributes associated with this connection. Each
|
||||
* entry key is the attribute identifier, while each value is the attribute
|
||||
* value itself.
|
||||
*
|
||||
* @return
|
||||
* The attribute map for this connection.
|
||||
*/
|
||||
public Map<String, String> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the map of all attributes associated with this connection. Each
|
||||
* entry key is the attribute identifier, while each value is the attribute
|
||||
* value itself.
|
||||
*
|
||||
* @param attributes
|
||||
* The attribute map for this connection.
|
||||
*/
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -115,6 +115,16 @@ public class APIConnectionWrapper implements Connection {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
return apiConnection.getAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
apiConnection.setAttributes(attributes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuacamoleTunnel connect(GuacamoleClientInformation info) throws GuacamoleException {
|
||||
throw new UnsupportedOperationException("Operation not supported.");
|
||||
|
@@ -305,6 +305,7 @@ public class ConnectionRESTService {
|
||||
existingConnection.setConfiguration(config);
|
||||
existingConnection.setParentIdentifier(connection.getParentIdentifier());
|
||||
existingConnection.setName(connection.getName());
|
||||
existingConnection.setAttributes(connection.getAttributes());
|
||||
connectionDirectory.update(existingConnection);
|
||||
|
||||
}
|
||||
|
@@ -23,7 +23,9 @@
|
||||
package org.glyptodon.guacamole.net.basic.rest.connectiongroup;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
import org.glyptodon.guacamole.net.auth.ConnectionGroup;
|
||||
import org.glyptodon.guacamole.net.auth.ConnectionGroup.Type;
|
||||
import org.glyptodon.guacamole.net.basic.rest.connection.APIConnection;
|
||||
@@ -34,6 +36,7 @@ import org.glyptodon.guacamole.net.basic.rest.connection.APIConnection;
|
||||
* @author James Muehlner
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
|
||||
public class APIConnectionGroup {
|
||||
|
||||
/**
|
||||
@@ -78,6 +81,11 @@ public class APIConnectionGroup {
|
||||
*/
|
||||
private Collection<APIConnection> childConnections;
|
||||
|
||||
/**
|
||||
* Map of all associated attributes by attribute identifier.
|
||||
*/
|
||||
private Map<String, String> attributes;
|
||||
|
||||
/**
|
||||
* Create an empty APIConnectionGroup.
|
||||
*/
|
||||
@@ -91,13 +99,16 @@ public class APIConnectionGroup {
|
||||
*/
|
||||
public APIConnectionGroup(ConnectionGroup connectionGroup) {
|
||||
|
||||
// Set connection group information
|
||||
this.identifier = connectionGroup.getIdentifier();
|
||||
this.parentIdentifier = connectionGroup.getParentIdentifier();
|
||||
|
||||
this.name = connectionGroup.getName();
|
||||
this.type = connectionGroup.getType();
|
||||
this.activeConnections = connectionGroup.getActiveConnections();
|
||||
|
||||
// Associate any attributes
|
||||
this.attributes = connectionGroup.getAttributes();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,4 +245,28 @@ public class APIConnectionGroup {
|
||||
this.activeConnections = activeConnections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of all attributes associated with this connection group.
|
||||
* Each entry key is the attribute identifier, while each value is the
|
||||
* attribute value itself.
|
||||
*
|
||||
* @return
|
||||
* The attribute map for this connection group.
|
||||
*/
|
||||
public Map<String, String> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the map of all attributes associated with this connection group.
|
||||
* Each entry key is the attribute identifier, while each value is the
|
||||
* attribute value itself.
|
||||
*
|
||||
* @param attributes
|
||||
* The attribute map for this connection group.
|
||||
*/
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
package org.glyptodon.guacamole.net.basic.rest.connectiongroup;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.net.GuacamoleTunnel;
|
||||
@@ -105,6 +106,16 @@ public class APIConnectionGroupWrapper implements ConnectionGroup {
|
||||
throw new UnsupportedOperationException("Operation not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
return apiConnectionGroup.getAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
apiConnectionGroup.setAttributes(attributes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuacamoleTunnel connect(GuacamoleClientInformation info) throws GuacamoleException {
|
||||
throw new UnsupportedOperationException("Operation not supported.");
|
||||
|
@@ -253,6 +253,7 @@ public class ConnectionGroupRESTService {
|
||||
existingConnectionGroup.setName(connectionGroup.getName());
|
||||
existingConnectionGroup.setParentIdentifier(connectionGroup.getParentIdentifier());
|
||||
existingConnectionGroup.setType(connectionGroup.getType());
|
||||
existingConnectionGroup.setAttributes(connectionGroup.getAttributes());
|
||||
connectionGroupDirectory.update(existingConnectionGroup);
|
||||
|
||||
}
|
||||
|
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Glyptodon LLC
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.glyptodon.guacamole.net.basic.rest.protocol;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.environment.Environment;
|
||||
import org.glyptodon.guacamole.environment.LocalEnvironment;
|
||||
import org.glyptodon.guacamole.net.basic.rest.AuthProviderRESTExposure;
|
||||
import org.glyptodon.guacamole.net.basic.rest.auth.AuthenticationService;
|
||||
import org.glyptodon.guacamole.protocols.ProtocolInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* A REST Service for handling the listing of protocols.
|
||||
*
|
||||
* @author James Muehlner
|
||||
*/
|
||||
@Path("/protocols")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public class ProtocolRESTService {
|
||||
|
||||
/**
|
||||
* Logger for this class.
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(ProtocolRESTService.class);
|
||||
|
||||
/**
|
||||
* A service for authenticating users from auth tokens.
|
||||
*/
|
||||
@Inject
|
||||
private AuthenticationService authenticationService;
|
||||
|
||||
/**
|
||||
* Gets a map of protocols defined in the system - protocol name to protocol.
|
||||
*
|
||||
* @param authToken
|
||||
* The authentication token that is used to authenticate the user
|
||||
* performing the operation.
|
||||
*
|
||||
* @return
|
||||
* A map of protocol information, where each key is the unique name
|
||||
* associated with that protocol.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the available protocols.
|
||||
*/
|
||||
@GET
|
||||
@AuthProviderRESTExposure
|
||||
public Map<String, ProtocolInfo> getProtocols(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
|
||||
// Verify the given auth token is valid
|
||||
authenticationService.getUserContext(authToken);
|
||||
|
||||
// Get and return a map of all protocols.
|
||||
Environment env = new LocalEnvironment();
|
||||
return env.getProtocols();
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Glyptodon LLC
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.glyptodon.guacamole.net.basic.rest.schema;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.environment.Environment;
|
||||
import org.glyptodon.guacamole.environment.LocalEnvironment;
|
||||
import org.glyptodon.guacamole.form.Parameter;
|
||||
import org.glyptodon.guacamole.net.auth.UserContext;
|
||||
import org.glyptodon.guacamole.net.basic.rest.AuthProviderRESTExposure;
|
||||
import org.glyptodon.guacamole.net.basic.rest.auth.AuthenticationService;
|
||||
import org.glyptodon.guacamole.protocols.ProtocolInfo;
|
||||
|
||||
/**
|
||||
* A REST service which provides access to descriptions of the properties,
|
||||
* attributes, etc. of objects used within the Guacamole REST API.
|
||||
*
|
||||
* @author Michael Jumper
|
||||
*/
|
||||
@Path("/schema")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public class SchemaRESTService {
|
||||
|
||||
/**
|
||||
* A service for authenticating users from auth tokens.
|
||||
*/
|
||||
@Inject
|
||||
private AuthenticationService authenticationService;
|
||||
|
||||
/**
|
||||
* Retrieves the possible attributes of a user object.
|
||||
*
|
||||
* @param authToken
|
||||
* The authentication token that is used to authenticate the user
|
||||
* performing the operation.
|
||||
*
|
||||
* @return
|
||||
* A collection of form parameters which describe the possible
|
||||
* attributes of a user object.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the possible attributes.
|
||||
*/
|
||||
@GET
|
||||
@Path("/users/attributes")
|
||||
@AuthProviderRESTExposure
|
||||
public Collection<Parameter> getUserAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
|
||||
// Retrieve all possible user attributes
|
||||
UserContext userContext = authenticationService.getUserContext(authToken);
|
||||
return userContext.getUserAttributes();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the possible attributes of a connection object.
|
||||
*
|
||||
* @param authToken
|
||||
* The authentication token that is used to authenticate the user
|
||||
* performing the operation.
|
||||
*
|
||||
* @return
|
||||
* A collection of form parameters which describe the possible
|
||||
* attributes of a connection object.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the possible attributes.
|
||||
*/
|
||||
@GET
|
||||
@Path("/connections/attributes")
|
||||
@AuthProviderRESTExposure
|
||||
public Collection<Parameter> getConnectionAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
|
||||
// Retrieve all possible connection attributes
|
||||
UserContext userContext = authenticationService.getUserContext(authToken);
|
||||
return userContext.getConnectionAttributes();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the possible attributes of a connection group object.
|
||||
*
|
||||
* @param authToken
|
||||
* The authentication token that is used to authenticate the user
|
||||
* performing the operation.
|
||||
*
|
||||
* @return
|
||||
* A collection of form parameters which describe the possible
|
||||
* attributes of a connection group object.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the possible attributes.
|
||||
*/
|
||||
@GET
|
||||
@Path("/connectionGroups/attributes")
|
||||
@AuthProviderRESTExposure
|
||||
public Collection<Parameter> getConnectionGroupAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
|
||||
// Retrieve all possible connection group attributes
|
||||
UserContext userContext = authenticationService.getUserContext(authToken);
|
||||
return userContext.getConnectionGroupAttributes();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a map of protocols defined in the system - protocol name to protocol.
|
||||
*
|
||||
* @param authToken
|
||||
* The authentication token that is used to authenticate the user
|
||||
* performing the operation.
|
||||
*
|
||||
* @return
|
||||
* A map of protocol information, where each key is the unique name
|
||||
* associated with that protocol.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the available protocols.
|
||||
*/
|
||||
@GET
|
||||
@Path("/protocols")
|
||||
@AuthProviderRESTExposure
|
||||
public Map<String, ProtocolInfo> getProtocols(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
|
||||
// Verify the given auth token is valid
|
||||
authenticationService.getUserContext(authToken);
|
||||
|
||||
// Get and return a map of all protocols.
|
||||
Environment env = new LocalEnvironment();
|
||||
return env.getProtocols();
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Glyptodon LLC
|
||||
* Copyright (C) 2015 Glyptodon LLC
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Classes related to the protocol retrieval aspect of the Guacamole REST API.
|
||||
* Classes related to the self-description of the Guacamole REST API, such as
|
||||
* the attributes or parameters applicable to specific objects.
|
||||
*/
|
||||
package org.glyptodon.guacamole.net.basic.rest.protocol;
|
||||
|
||||
package org.glyptodon.guacamole.net.basic.rest.schema;
|
@@ -22,6 +22,7 @@
|
||||
|
||||
package org.glyptodon.guacamole.net.basic.rest.user;
|
||||
|
||||
import java.util.Map;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
import org.glyptodon.guacamole.net.auth.User;
|
||||
@@ -45,6 +46,11 @@ public class APIUser {
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* Map of all associated attributes by attribute identifier.
|
||||
*/
|
||||
private Map<String, String> attributes;
|
||||
|
||||
/**
|
||||
* Construct a new empty APIUser.
|
||||
*/
|
||||
@@ -55,8 +61,14 @@ public class APIUser {
|
||||
* @param user The User to construct the APIUser from.
|
||||
*/
|
||||
public APIUser(User user) {
|
||||
|
||||
// Set user information
|
||||
this.username = user.getIdentifier();
|
||||
this.password = user.getPassword();
|
||||
|
||||
// Associate any attributes
|
||||
this.attributes = user.getAttributes();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,4 +103,28 @@ public class APIUser {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of all attributes associated with this user. Each entry
|
||||
* key is the attribute identifier, while each value is the attribute
|
||||
* value itself.
|
||||
*
|
||||
* @return
|
||||
* The attribute map for this user.
|
||||
*/
|
||||
public Map<String, String> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the map of all attributes associated with this user. Each entry key
|
||||
* is the attribute identifier, while each value is the attribute value
|
||||
* itself.
|
||||
*
|
||||
* @param attributes
|
||||
* The attribute map for this user.
|
||||
*/
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
package org.glyptodon.guacamole.net.basic.rest.user;
|
||||
|
||||
import java.util.Map;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.GuacamoleUnsupportedException;
|
||||
import org.glyptodon.guacamole.net.auth.User;
|
||||
@@ -71,6 +72,16 @@ public class APIUserWrapper implements User {
|
||||
apiUser.setPassword(password);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
return apiUser.getAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
apiUser.setAttributes(attributes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemPermissionSet getSystemPermissions()
|
||||
throws GuacamoleException {
|
||||
|
@@ -291,6 +291,9 @@ public class UserRESTService {
|
||||
if (user.getPassword() != null)
|
||||
existingUser.setPassword(user.getPassword());
|
||||
|
||||
// Update user attributes
|
||||
existingUser.setAttributes(user.getAttributes());
|
||||
|
||||
// Update the user
|
||||
userDirectory.update(existingUser);
|
||||
|
||||
|
@@ -41,7 +41,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
||||
var connectionService = $injector.get('connectionService');
|
||||
var connectionGroupService = $injector.get('connectionGroupService');
|
||||
var permissionService = $injector.get('permissionService');
|
||||
var protocolService = $injector.get('protocolService');
|
||||
var schemaService = $injector.get('schemaService');
|
||||
var translationStringService = $injector.get('translationStringService');
|
||||
|
||||
/**
|
||||
@@ -205,7 +205,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
||||
});
|
||||
|
||||
// Get protocol metadata
|
||||
protocolService.getProtocols().success(function protocolsReceived(protocols) {
|
||||
schemaService.getProtocols().success(function protocolsReceived(protocols) {
|
||||
$scope.protocols = protocols;
|
||||
});
|
||||
|
||||
|
@@ -49,11 +49,11 @@ angular.module('rest').factory('cacheService', ['$injector',
|
||||
service.languages = $cacheFactory('API-LANGUAGES');
|
||||
|
||||
/**
|
||||
* Cache used by protocolService.
|
||||
* Cache used by schemaService.
|
||||
*
|
||||
* @type $cacheFactory.Cache
|
||||
*/
|
||||
service.protocols = $cacheFactory('API-PROTOCOLS');
|
||||
service.schema = $cacheFactory('API-SCHEMA');
|
||||
|
||||
/**
|
||||
* Shared cache used by both userService and permissionService.
|
||||
@@ -68,7 +68,7 @@ angular.module('rest').factory('cacheService', ['$injector',
|
||||
service.clearCaches = function clearCaches() {
|
||||
service.connections.removeAll();
|
||||
service.languages.removeAll();
|
||||
service.protocols.removeAll();
|
||||
service.schema.removeAll();
|
||||
service.users.removeAll();
|
||||
};
|
||||
|
||||
|
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Glyptodon LLC
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service for operating on protocol metadata via the REST API.
|
||||
*/
|
||||
angular.module('rest').factory('protocolService', ['$injector',
|
||||
function protocolService($injector) {
|
||||
|
||||
// Required services
|
||||
var $http = $injector.get('$http');
|
||||
var authenticationService = $injector.get('authenticationService');
|
||||
var cacheService = $injector.get('cacheService');
|
||||
|
||||
var service = {};
|
||||
|
||||
/**
|
||||
* Makes a request to the REST API to get the list of protocols, returning
|
||||
* a promise that provides a map of @link{Protocol} objects by protocol
|
||||
* name if successful.
|
||||
*
|
||||
* @returns {Promise.<Object.<String, Protocol>>}
|
||||
* A promise which will resolve with a map of @link{Protocol}
|
||||
* objects by protocol name upon success.
|
||||
*/
|
||||
service.getProtocols = function getProtocols() {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve available protocols
|
||||
return $http({
|
||||
cache : cacheService.protocols,
|
||||
method : 'GET',
|
||||
url : 'api/protocols',
|
||||
params : httpParameters
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
return service;
|
||||
|
||||
}]);
|
145
guacamole/src/main/webapp/app/rest/services/schemaService.js
Normal file
145
guacamole/src/main/webapp/app/rest/services/schemaService.js
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Glyptodon LLC
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service for operating on metadata via the REST API.
|
||||
*/
|
||||
angular.module('rest').factory('schemaService', ['$injector',
|
||||
function schemaService($injector) {
|
||||
|
||||
// Required services
|
||||
var $http = $injector.get('$http');
|
||||
var authenticationService = $injector.get('authenticationService');
|
||||
var cacheService = $injector.get('cacheService');
|
||||
|
||||
var service = {};
|
||||
|
||||
/**
|
||||
* Makes a request to the REST API to get the list of available attributes
|
||||
* for user objects, returning a promise that provides an array of
|
||||
* @link{Field} objects if successful. Each element of the array describes
|
||||
* a possible attribute.
|
||||
*
|
||||
* @returns {Promise.<Field[]>}
|
||||
* A promise which will resolve with an array of @link{Field}
|
||||
* objects, where each @link{Field} describes a possible attribute.
|
||||
*/
|
||||
service.getUserAttributes = function getUserAttributes() {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve available user attributes
|
||||
return $http({
|
||||
cache : cacheService.schema,
|
||||
method : 'GET',
|
||||
url : 'api/schema/users/attributes',
|
||||
params : httpParameters
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Makes a request to the REST API to get the list of available attributes
|
||||
* for connection objects, returning a promise that provides an array of
|
||||
* @link{Field} objects if successful. Each element of the array describes
|
||||
* a possible attribute.
|
||||
*
|
||||
* @returns {Promise.<Field[]>}
|
||||
* A promise which will resolve with an array of @link{Field}
|
||||
* objects, where each @link{Field} describes a possible attribute.
|
||||
*/
|
||||
service.getConnectionAttributes = function getConnectionAttributes() {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve available connection attributes
|
||||
return $http({
|
||||
cache : cacheService.schema,
|
||||
method : 'GET',
|
||||
url : 'api/schema/connections/attributes',
|
||||
params : httpParameters
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Makes a request to the REST API to get the list of available attributes
|
||||
* for connection group objects, returning a promise that provides an array
|
||||
* of @link{Field} objects if successful. Each element of the array
|
||||
* describes a possible attribute.
|
||||
*
|
||||
* @returns {Promise.<Field[]>}
|
||||
* A promise which will resolve with an array of @link{Field}
|
||||
* objects, where each @link{Field} describes a possible attribute.
|
||||
*/
|
||||
service.getConnectionGroupAttributes = function getConnectionGroupAttributes() {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve available connection group attributes
|
||||
return $http({
|
||||
cache : cacheService.schema,
|
||||
method : 'GET',
|
||||
url : 'api/schema/connectionGroups/attributes',
|
||||
params : httpParameters
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Makes a request to the REST API to get the list of protocols, returning
|
||||
* a promise that provides a map of @link{Protocol} objects by protocol
|
||||
* name if successful.
|
||||
*
|
||||
* @returns {Promise.<Object.<String, Protocol>>}
|
||||
* A promise which will resolve with a map of @link{Protocol}
|
||||
* objects by protocol name upon success.
|
||||
*/
|
||||
service.getProtocols = function getProtocols() {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve available protocols
|
||||
return $http({
|
||||
cache : cacheService.schema,
|
||||
method : 'GET',
|
||||
url : 'api/schema/protocols',
|
||||
params : httpParameters
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
return service;
|
||||
|
||||
}]);
|
@@ -80,6 +80,15 @@ angular.module('rest').factory('Connection', [function defineConnection() {
|
||||
*/
|
||||
this.parameters = template.parameters;
|
||||
|
||||
/**
|
||||
* Arbitrary name/value pairs which further describe this connection.
|
||||
* The semantics and validity of these attributes are dictated by the
|
||||
* extension which defines them.
|
||||
*
|
||||
* @type Object.<String, String>
|
||||
*/
|
||||
this.attributes = {};
|
||||
|
||||
/**
|
||||
* The count of currently active connections using this connection.
|
||||
* This field will be returned from the REST API during a get
|
||||
|
@@ -91,6 +91,15 @@ angular.module('rest').factory('ConnectionGroup', [function defineConnectionGrou
|
||||
*/
|
||||
this.childConnectionGroups = template.childConnectionGroups;
|
||||
|
||||
/**
|
||||
* Arbitrary name/value pairs which further describe this connection
|
||||
* group. The semantics and validity of these attributes are dictated
|
||||
* by the extension which defines them.
|
||||
*
|
||||
* @type Object.<String, String>
|
||||
*/
|
||||
this.attributes = {};
|
||||
|
||||
/**
|
||||
* The count of currently active connections using this connection
|
||||
* group. This field will be returned from the REST API during a get
|
||||
|
@@ -56,6 +56,15 @@ angular.module('rest').factory('User', [function defineUser() {
|
||||
*/
|
||||
this.password = template.password;
|
||||
|
||||
/**
|
||||
* Arbitrary name/value pairs which further describe this user. The
|
||||
* semantics and validity of these attributes are dictated by the
|
||||
* extension which defines them.
|
||||
*
|
||||
* @type Object.<String, String>
|
||||
*/
|
||||
this.attributes = {};
|
||||
|
||||
};
|
||||
|
||||
return User;
|
||||
|
Reference in New Issue
Block a user