You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by vnick <vn...@apache.org> on 2017/10/17 00:40:45 UTC

Re: Passing current client to extension

Cayetano wrote
> I am writing an extension that adds a few "buttons" to each connection.
> 
> It works fine by passing "{{context.getClientIdentifier (item)}}" for
> connection data.
> I need to also pass the name or the identifier of the user that is logged
> in. Something similar to:
> 
> http: //someserver/page.php? connection = {{context.getClientIdentifier
> (item)}} & user = .....
> 
> Can you help me with this?
> 
> I've tried using {item.currenUserName} and others, with no result.
> 
> Thank you

I don't think you'll find it in the context object where you're getting the
connection name.  Take a look at the authenticationService module, and the
getCurrentUsername() method, in particular:

https://github.com/apache/incubator-guacamole-client/blob/b8abcd6755f9d44bf9b32daaf240c1361811751d/guacamole/src/main/webapp/app/auth/service/authenticationService.js#L347
<https://github.com/apache/incubator-guacamole-client/blob/b8abcd6755f9d44bf9b32daaf240c1361811751d/guacamole/src/main/webapp/app/auth/service/authenticationService.js#L347>  

You'll need to inject the authenticationService module into your javascript
code, and make sure you make it available to whatever template you're
constructing, but it should be relatively straight-forward to get the
username.

-Nick



--
Sent from: http://apache-guacamole-incubating-users.2363388.n4.nabble.com/