This closes #4019
This commit is contained in:
commit
6135d6bbe9
|
@ -244,7 +244,7 @@ var Artemis;
|
|||
{name: "Large", visible: true},
|
||||
{name: "Persistent Size", visible: true},
|
||||
{name: "User ID", visible: true},
|
||||
{name: "Validated User", visible: true},
|
||||
{name: "Validated User", visible: false},
|
||||
{name: "Original Queue (Expiry/DLQ's only)", visible: true}
|
||||
]
|
||||
};
|
||||
|
@ -326,7 +326,7 @@ var Artemis;
|
|||
header: 'User ID'
|
||||
},
|
||||
{
|
||||
itemField: 'StringProperties',
|
||||
itemField: 'validatedUser',
|
||||
header: 'Validated User',
|
||||
templateFn: function(value) {
|
||||
return value._AMQ_VALIDATED_USER;
|
||||
|
|
|
@ -87,6 +87,7 @@ var Artemis;
|
|||
{name: "ID", visible: true},
|
||||
{name: "Session", visible: true},
|
||||
{name: "Client ID", visible: true},
|
||||
{name: "Validated User", visible: false},
|
||||
{name: "Protocol", visible: true},
|
||||
{name: "Queue", visible: true},
|
||||
{name: "Queue Type", visible: true},
|
||||
|
@ -121,6 +122,7 @@ var Artemis;
|
|||
{id: 'session', name: 'Session'},
|
||||
{id: 'clientID', name: 'Client ID'},
|
||||
{id: 'user', name: 'User'},
|
||||
{id: 'validatedUser', name: 'Validated User'},
|
||||
{id: 'address', name: 'Address'},
|
||||
{id: 'queue', name: 'Queue'},
|
||||
{id: 'protocol', name: 'Protocol'},
|
||||
|
@ -168,6 +170,7 @@ var Artemis;
|
|||
{ header: 'ID', itemField: 'id' },
|
||||
{ header: 'Session', itemField: 'session' , templateFn: function(value, item) { return '<a href="#" onclick="selectSession(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
|
||||
{ header: 'Client ID', itemField: 'clientID' },
|
||||
{ header: 'Validated User', itemField: 'validatedUser' },
|
||||
{ header: 'Protocol', itemField: 'protocol' },
|
||||
{ header: 'Queue', itemField: 'queue', templateFn: function(value, item) { return '<a href="#" onclick="selectQueue(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
|
||||
{ header: 'Queue Type', itemField: 'queueType' },
|
||||
|
|
|
@ -73,6 +73,7 @@ var Artemis;
|
|||
{name: "Client ID", visible: true},
|
||||
{name: "Protocol", visible: true},
|
||||
{name: "User", visible: true},
|
||||
{name: "Validated User", visible: false},
|
||||
{name: "Address", visible: true},
|
||||
{name: "Remote Address", visible: true},
|
||||
{name: "Local Address", visible: true}
|
||||
|
@ -102,6 +103,7 @@ var Artemis;
|
|||
{id: 'session', name: 'Session'},
|
||||
{id: 'clientID', name: 'Client ID'},
|
||||
{id: 'user', name: 'User'},
|
||||
{id: 'validatedUser', name: 'Validated User'},
|
||||
{id: 'address', name: 'Address'},
|
||||
{id: 'protocol', name: 'Protocol'},
|
||||
{id: 'localAddress', name: 'Local Address'},
|
||||
|
@ -139,6 +141,7 @@ var Artemis;
|
|||
{ header: 'Client ID', itemField: 'clientID' },
|
||||
{ header: 'Protocol', itemField: 'protocol' },
|
||||
{ header: 'User', itemField: 'user' },
|
||||
{ header: 'Validated User', name: 'validatedUser'},
|
||||
{ header: 'Address', itemField: 'address', templateFn: function(value, item) { return '<a href="#" onclick="selectAddress(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
|
||||
{ header: 'Remote Address', itemField: 'remoteAddress' },
|
||||
{ header: 'Local Address', itemField: 'localAddress' }
|
||||
|
|
|
@ -88,6 +88,7 @@ var Artemis;
|
|||
{name: "ID", visible: true},
|
||||
{name: "Connection", visible: true},
|
||||
{name: "User", visible: true},
|
||||
{name: "Validated User", visible: false},
|
||||
{name: "Consumer Count", visible: true},
|
||||
{name: "Producer Count", visible: true},
|
||||
{name: "Creation Time", visible: true}
|
||||
|
@ -117,6 +118,7 @@ var Artemis;
|
|||
{id: 'connectionID', name: 'Connection ID'},
|
||||
{id: 'consumerCount', name: 'Consumer Count'},
|
||||
{id: 'user', name: 'User'},
|
||||
{id: 'validatedUser', name: 'Validated User'},
|
||||
{id: 'protocol', name: 'Protocol'},
|
||||
{id: 'clientID', name: 'Client ID'},
|
||||
{id: 'localAddress', name: 'Local Address'},
|
||||
|
@ -162,6 +164,7 @@ var Artemis;
|
|||
{ header: 'ID', itemField: 'id' },
|
||||
{ header: 'Connection', itemField: 'connectionID', templateFn: function(value, item) { return '<a href="#" onclick="selectConnection(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
|
||||
{ header: 'User', itemField: 'user' },
|
||||
{ header: 'Validated User', itemField: 'validatedUser' },
|
||||
{ header: 'Consumer Count', itemField: 'consumerCount', templateFn: function(value, item) { return '<a href="#" onclick="selectConsumers(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
|
||||
{ header: 'Producer Count', itemField: 'producerCount', templateFn: function(value, item) { return '<a href="#" onclick="selectProducers(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
|
||||
{ header: 'Creation Time', itemField: 'creationTime' }
|
||||
|
|
|
@ -2651,7 +2651,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("sessionID", sess.getName()).add("creationTime", sess.getCreationTime()).add("consumerCount", sess.getServerConsumers().size());
|
||||
|
||||
if (sess.getValidatedUser() != null) {
|
||||
obj.add("principal", sess.getValidatedUser());
|
||||
obj.add("validatedUser", sess.getValidatedUser());
|
||||
}
|
||||
|
||||
if (sess.getMetaData() != null) {
|
||||
|
|
|
@ -26,6 +26,7 @@ public enum ConsumerField {
|
|||
FILTER("filter"),
|
||||
ADDRESS("address"),
|
||||
USER("user"),
|
||||
VALIDATED_USER("validatedUser"),
|
||||
PROTOCOL("protocol"),
|
||||
CLIENT_ID("clientID"),
|
||||
LOCAL_ADDRESS("localAddress"),
|
||||
|
|
|
@ -63,6 +63,7 @@ public class ConsumerView extends ActiveMQAbstractView<ServerConsumer> {
|
|||
.add(ConsumerField.SESSION.getName(), toString(consumer.getSessionName()))
|
||||
.add(ConsumerField.CLIENT_ID.getName(), toString(consumerClientID))
|
||||
.add(ConsumerField.USER.getName(), toString(session.getUsername()))
|
||||
.add(ConsumerField.VALIDATED_USER.getName(), toString(session.getValidatedUser()))
|
||||
.add(ConsumerField.PROTOCOL.getName(), toString(consumer.getConnectionProtocolName()))
|
||||
.add(ConsumerField.QUEUE.getName(), toString(consumer.getQueueName()))
|
||||
.add(ConsumerField.QUEUE_TYPE.getName(), toString(consumer.getQueueType()).toLowerCase())
|
||||
|
@ -92,6 +93,8 @@ public class ConsumerView extends ActiveMQAbstractView<ServerConsumer> {
|
|||
return consumer.getSessionName();
|
||||
case USER:
|
||||
return session.getUsername();
|
||||
case VALIDATED_USER:
|
||||
return session.getValidatedUser();
|
||||
case CLIENT_ID:
|
||||
return consumer.getConnectionClientID();
|
||||
case PROTOCOL:
|
||||
|
|
|
@ -24,6 +24,7 @@ public enum ProducerField {
|
|||
SESSION("session"),
|
||||
CONNECTION_ID("connectionID"),
|
||||
ADDRESS("address"), USER("user"),
|
||||
VALIDATED_USER("validatedUser"),
|
||||
PROTOCOL("protocol"),
|
||||
CLIENT_ID("clientID"),
|
||||
LOCAL_ADDRESS("localAddress"),
|
||||
|
|
|
@ -62,6 +62,7 @@ public class ProducerView extends ActiveMQAbstractView<ServerProducer> {
|
|||
.add(ProducerField.SESSION.getName(), toString(session.getName()))
|
||||
.add(ProducerField.CLIENT_ID.getName(), toString(sessionClientID))
|
||||
.add(ProducerField.USER.getName(), toString(session.getUsername()))
|
||||
.add(ProducerField.VALIDATED_USER.getName(), toString(session.getValidatedUser()))
|
||||
.add(ProducerField.PROTOCOL.getName(), toString(session.getRemotingConnection().getProtocolName()))
|
||||
.add(ProducerField.ADDRESS.getName(), toString(producer.getAddress() != null ? producer.getAddress() : session.getDefaultAddress()))
|
||||
.add(ProducerField.LOCAL_ADDRESS.getName(), toString(session.getRemotingConnection().getTransportConnection().getLocalAddress()))
|
||||
|
@ -88,6 +89,8 @@ public class ProducerView extends ActiveMQAbstractView<ServerProducer> {
|
|||
return session.getName();
|
||||
case USER:
|
||||
return session.getUsername();
|
||||
case VALIDATED_USER:
|
||||
return session.getValidatedUser();
|
||||
case CLIENT_ID:
|
||||
return session.getRemotingConnection().getClientID();
|
||||
case PROTOCOL:
|
||||
|
|
|
@ -25,6 +25,7 @@ public enum SessionField {
|
|||
CONSUMER_COUNT("consumerCount"),
|
||||
PRODUCER_COUNT("producerCount"),
|
||||
USER("user"),
|
||||
VALIDATED_USER("validatedUser"),
|
||||
PROTOCOL("protocol"),
|
||||
CLIENT_ID("clientID"),
|
||||
LOCAL_ADDRESS("localAddress"),
|
||||
|
|
|
@ -42,6 +42,7 @@ public class SessionView extends ActiveMQAbstractView<ServerSession> {
|
|||
JsonObjectBuilder obj = JsonLoader.createObjectBuilder()
|
||||
.add(SessionField.ID.getName(), toString(session.getName()))
|
||||
.add(SessionField.USER.getName(), toString(session.getUsername()))
|
||||
.add(SessionField.VALIDATED_USER.getName(), toString(session.getValidatedUser()))
|
||||
.add(SessionField.CREATION_TIME.getName(), new Date(session.getCreationTime()).toString())
|
||||
.add(SessionField.CONSUMER_COUNT.getName(), session.getConsumerCount())
|
||||
.add(SessionField.PRODUCER_COUNT.getName(), session.getProducerCount())
|
||||
|
@ -58,6 +59,8 @@ public class SessionView extends ActiveMQAbstractView<ServerSession> {
|
|||
return session.getName();
|
||||
case USER:
|
||||
return session.getUsername();
|
||||
case VALIDATED_USER:
|
||||
return session.getValidatedUser();
|
||||
case CREATION_TIME:
|
||||
return new Date(session.getCreationTime());
|
||||
case CONSUMER_COUNT:
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.activemq.artemis.core.management.impl.view.predicate;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.activemq.artemis.core.management.impl.view.ConnectionField;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
||||
|
@ -46,13 +47,7 @@ public class ConnectionFilterPredicate extends ActiveMQFilterPredicate<RemotingC
|
|||
case CLIENT_ID:
|
||||
return matches(connection.getClientID());
|
||||
case USERS:
|
||||
List<ServerSession> sessions = server.getSessions(connection.getID().toString());
|
||||
Set<String> users = new HashSet<>();
|
||||
for (ServerSession session : sessions) {
|
||||
String username = session.getUsername() == null ? "" : session.getUsername();
|
||||
users.add(username);
|
||||
}
|
||||
return matchAny(users);
|
||||
return matchAny(collectFromSessions(connection.getID().toString(), s-> s.getUsername()));
|
||||
case PROTOCOL:
|
||||
return matches(connection.getProtocolName());
|
||||
case SESSION_COUNT:
|
||||
|
@ -71,6 +66,17 @@ public class ConnectionFilterPredicate extends ActiveMQFilterPredicate<RemotingC
|
|||
return true;
|
||||
}
|
||||
|
||||
Set<String> collectFromSessions(String connectionId, Function<ServerSession, String> getter) {
|
||||
List<ServerSession> sessions = server.getSessions(connectionId);
|
||||
Set<String> sessionAttributes = new HashSet<>();
|
||||
for (ServerSession session : sessions) {
|
||||
String value = getter.apply(session);
|
||||
String string = value == null ? "" : value;
|
||||
sessionAttributes.add(string);
|
||||
}
|
||||
return sessionAttributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(String field) {
|
||||
if (field != null && !field.equals("")) {
|
||||
|
|
|
@ -43,6 +43,8 @@ public class ConsumerFilterPredicate extends ActiveMQFilterPredicate<ServerConsu
|
|||
return matches(consumer.getSessionID());
|
||||
case USER:
|
||||
return matches(server.getSessionByID(consumer.getSessionID()).getUsername());
|
||||
case VALIDATED_USER:
|
||||
return matches(server.getSessionByID(consumer.getSessionID()).getValidatedUser());
|
||||
case ADDRESS:
|
||||
return matches(consumer.getQueue().getAddress());
|
||||
case QUEUE:
|
||||
|
|
|
@ -45,6 +45,8 @@ public class ProducerFilterPredicate extends ActiveMQFilterPredicate<ServerProdu
|
|||
return matches(producer.getSessionID());
|
||||
case USER:
|
||||
return matches(server.getSessionByID(producer.getSessionID()).getUsername());
|
||||
case VALIDATED_USER:
|
||||
return matches(server.getSessionByID(producer.getSessionID()).getValidatedUser());
|
||||
case ADDRESS:
|
||||
return matches(producer.getAddress() != null ? producer.getAddress() : server.getSessionByID(producer.getSessionID()).getDefaultAddress());
|
||||
case PROTOCOL:
|
||||
|
|
Loading…
Reference in New Issue