if (isSet(EXPAND))
{
if (action.getOperation() == Operation.CREATE && action.getObjectType() == ObjectType.TOPIC)
{
addRule(null, identity, noLog(permission), new Action(Operation.BIND, ObjectType.EXCHANGE,
new ObjectProperties("amq.topic", action.getProperties().get(ObjectProperties.Property.NAME))));
ObjectProperties topicProperties = new ObjectProperties();
topicProperties.put(ObjectProperties.Property.DURABLE, true);
addRule(null, identity, permission, new Action(Operation.CREATE, ObjectType.QUEUE, topicProperties));
return;
}
if (action.getOperation() == Operation.DELETE && action.getObjectType() == ObjectType.TOPIC)
{
addRule(null, identity, noLog(permission), new Action(Operation.UNBIND, ObjectType.EXCHANGE,
new ObjectProperties("amq.topic", action.getProperties().get(ObjectProperties.Property.NAME))));
ObjectProperties topicProperties = new ObjectProperties();
topicProperties.put(ObjectProperties.Property.DURABLE, true);
addRule(null, identity, permission, new Action(Operation.DELETE, ObjectType.QUEUE, topicProperties));
return;
}
}
// transitive action dependencies
if (isSet(TRANSITIVE))
{
if (action.getOperation() == Operation.CREATE && action.getObjectType() == ObjectType.QUEUE)
{
ObjectProperties exchProperties = new ObjectProperties(action.getProperties());
exchProperties.setName(ExchangeDefaults.DEFAULT_EXCHANGE_NAME);
exchProperties.put(ObjectProperties.Property.ROUTING_KEY, action.getProperties().get(ObjectProperties.Property.NAME));
addRule(null, identity, noLog(permission), new Action(Operation.BIND, ObjectType.EXCHANGE, exchProperties));
if (action.getProperties().isSet(ObjectProperties.Property.AUTO_DELETE))
{
addRule(null, identity, noLog(permission), new Action(Operation.DELETE, ObjectType.QUEUE, action.getProperties()));
}
}
else if (action.getOperation() == Operation.DELETE && action.getObjectType() == ObjectType.QUEUE)
{
ObjectProperties exchProperties = new ObjectProperties(action.getProperties());
exchProperties.setName(ExchangeDefaults.DEFAULT_EXCHANGE_NAME);
exchProperties.put(ObjectProperties.Property.ROUTING_KEY, action.getProperties().get(ObjectProperties.Property.NAME));
addRule(null, identity, noLog(permission), new Action(Operation.UNBIND, ObjectType.EXCHANGE, exchProperties));
}
else if (action.getOperation() != Operation.ACCESS && action.getObjectType() != ObjectType.VIRTUALHOST)
{
addRule(null, identity, noLog(permission), new Action(Operation.ACCESS, ObjectType.VIRTUALHOST));