Skip to content

Commit

Permalink
bug fix:broker_h2.sql (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
caseone authored Mar 24, 2021
1 parent 2bb35dc commit 9202e2f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ public Optional<MqttMessage> process(MqttMessage req, String sessionId, String r
}
}
if (!isAuth) {
log.error("userName:{},topicName:{}, not publish permission", userName, topicName);
throw new BrokerException(ErrorCode.MQTT_NOT_PERMISSION);
log.error("userName:{},topicName:{}, no publish permission", userName, topicName);
throw new BrokerException(ErrorCode.MQTT_NO_PUB_PERMISSION);
}
}

Expand All @@ -236,12 +236,12 @@ public Optional<MqttMessage> process(MqttMessage req, String sessionId, String r
if (null != entity && (entity.getPermission() == SUB_PUB || entity.getPermission() == PUB)) {
continue;
}
log.error("userName:{},topicName:{}, not subscribe permission", userName, topicName);
log.error("userName:{},topicName:{}, no subscribe permission", userName, topicName);
isAuth = false;
break;
}
if (!isAuth) {
throw new BrokerException(ErrorCode.MQTT_NOT_PERMISSION);
throw new BrokerException(ErrorCode.MQTT_NO_SUB_PERMISSION);
}
}

Expand Down
2 changes: 1 addition & 1 deletion weevent-broker/src/main/resources/script/broker_h2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ create TABLE t_account_topic_auth(
create_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id)
)
);

alter table t_account add CONSTRAINT userName UNIQUE (user_name);
alter table t_account_topic_auth add CONSTRAINT userNameTopicName UNIQUE (user_name, topic_name);
2 changes: 1 addition & 1 deletion weevent-broker/src/main/resources/weevent.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ block.chain.type=fisco
#stomp heartbeats
stomp.heartbeats=30
#mqtt broker
mqtt.broker.tcp.port=7001
#mqtt.broker.tcp.port=7001
mqtt.broker.keepalive=60
mqtt.broker.security.ssl=false
mqtt.broker.security.ssl.client_auth=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ public enum ErrorCode {
MQTT_CONNECT_CONFLICT(200610, "connect command conflict with specification 3.1.1"),
MQTT_UNKNOWN_CLIENT_ID(200611, "unknown client id"),
MQTT_NOT_SUPPORT_QOS2(200612, "do not support qos=2"),
MQTT_NOT_PERMISSION(200613, "not permission"),
MQTT_SSL_ERROR(200614, "mqtt get ssl context error"),
MQTT_NO_SUB_PERMISSION(200613, "no suscribe permission"),
MQTT_NO_PUB_PERMISSION(200614, "no publish permission"),
MQTT_SSL_ERROR(200615, "mqtt get ssl context error"),


FTP_INVALID_USERNAME_PASSWD(200700, "invalid username or password"),
Expand Down

0 comments on commit 9202e2f

Please sign in to comment.