GUACAMOLE-5: Display the username of the user that shares a connection.

This commit is contained in:
Michael Jumper
2016-07-29 17:47:16 -07:00
parent ecaf5be84e
commit ff3c57dff0
6 changed files with 70 additions and 2 deletions

View File

@@ -42,6 +42,12 @@ import org.apache.guacamole.protocol.GuacamoleConfiguration;
*/ */
public class SharedConnection implements Connection { public class SharedConnection implements Connection {
/**
* The name of the attribute which contains the username of the user that
* shared this connection.
*/
public static final String CONNECTION_OWNER = "jdbc-shared-by";
/** /**
* Service for establishing tunnels to Guacamole connections. * Service for establishing tunnels to Guacamole connections.
*/ */
@@ -133,12 +139,13 @@ public class SharedConnection implements Connection {
@Override @Override
public Map<String, String> getAttributes() { public Map<String, String> getAttributes() {
return Collections.<String, String>emptyMap(); String sharedBy = definition.getActiveConnection().getUser().getIdentifier();
return Collections.<String, String>singletonMap(CONNECTION_OWNER, sharedBy);
} }
@Override @Override
public void setAttributes(Map<String, String> attributes) { public void setAttributes(Map<String, String> attributes) {
// Do nothing - no attributes supported // Do nothing - changing attributes not supported
} }
@Override @Override

View File

@@ -0,0 +1,6 @@
<meta name="after" content=".caption .activeUserCount">
<!-- The user sharing this connection (if any) -->
<span class="jdbc-share-tag" ng-show="item.wrappedItem.attributes['jdbc-shared-by']"
translate="HOME.INFO_SHARED_BY"
translate-values="{USERNAME: item.wrappedItem.attributes['jdbc-shared-by']}"></span>

View File

@@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* Label/tag denoting the user that shared a connection */
.jdbc-share-tag {
background: #0095ff;
padding: 0.25em;
-moz-border-radius: 0.25em;
-webkit-border-radius: 0.25em;
-khtml-border-radius: 0.25em;
border-radius: 0.25em;
color: white;
font-size: 0.75em;
font-weight: bold;
}

View File

@@ -42,6 +42,10 @@
"NAME" : "PostgreSQL" "NAME" : "PostgreSQL"
}, },
"HOME" : {
"INFO_SHARED_BY" : "Shared by {USERNAME}"
},
"USER_ATTRIBUTES" : { "USER_ATTRIBUTES" : {
"FIELD_HEADER_DISABLED" : "Login disabled:", "FIELD_HEADER_DISABLED" : "Login disabled:",

View File

@@ -10,6 +10,14 @@
"org.apache.guacamole.auth.mysql.MySQLSharedAuthenticationProvider" "org.apache.guacamole.auth.mysql.MySQLSharedAuthenticationProvider"
], ],
"css" : [
"styles/jdbc.css"
],
"html" : [
"html/shared-connection.html"
],
"translations" : [ "translations" : [
"translations/en.json", "translations/en.json",
"translations/fr.json", "translations/fr.json",

View File

@@ -10,6 +10,14 @@
"org.apache.guacamole.auth.postgresql.PostgreSQLSharedAuthenticationProvider" "org.apache.guacamole.auth.postgresql.PostgreSQLSharedAuthenticationProvider"
], ],
"css" : [
"styles/jdbc.css"
],
"html" : [
"html/shared-connection.html"
],
"translations" : [ "translations" : [
"translations/en.json", "translations/en.json",
"translations/fr.json", "translations/fr.json",