On Sat, Mar 10, 2018 at 1:30 AM, Joachim Lindenberg <joac...@lindenberg.one>
wrote:

> Hello once more,
>
> I´d like to show the status of a VM on the list shown to a user after
> authentication – of course via my own extension enumerating the
> connections. Not knowing another way I tried to include the status into the
> connection name, but that confuses the recent connections display.
>
> Is there a way to add a column with status information, without changing
> the overall webapp?
>

Yes. Connections and similar objects within the extension API provide a Map
of arbitrary name/value attributes which your extension can expose:

http://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/auth/Connection.html#getAttributes--

These attributes are exposed on the JavaScript side in the connection
objects received from the corresponding REST service:

https://github.com/apache/guacamole-client/blob/b8a5f0bd2202077b1048baf7b903abc823e3df30/guacamole/src/main/webapp/app/rest/types/Connection.js#L80-L87

You can see this leveraged in practice within the JDBC auth extension,
which needs to add its own "Shared by [name]" tag next to connections
shared by a particular user via a share link. An additional
"jdbc-shared-by" attribute is exposed through implementing getAttributes()
on the applicable Connection subclass:

https://github.com/apache/guacamole-client/blob/b8a5f0bd2202077b1048baf7b903abc823e3df30/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/connection/SharedConnection.java#L139-L143

The additional template content which renders this information is then
added with a template patch (in an area of the Guacamole interface where a
connection object from the REST service is already available),
conditionally shown only if the attribute is actually set:

https://github.com/apache/guacamole-client/blob/b8a5f0bd2202077b1048baf7b903abc823e3df30/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/resources/html/shared-connection.html

- Mike

Reply via email to