|
|
@@ -413,13 +413,6 @@ public class GateWayUserInfoService {
|
|
|
ActiveMQServerControl addressControl = MBeanServerInvocationHandler.newProxyInstance(connection, addressObjectName, ActiveMQServerControl.class, false);
|
|
|
|
|
|
final String _roleName = MqttConfig.adminRoleName;
|
|
|
- addressControl.addSecuritySettings("#", _roleName, _roleName, _roleName, _roleName,
|
|
|
- _roleName, _roleName, _roleName, _roleName,
|
|
|
- _roleName, _roleName);
|
|
|
-//
|
|
|
-// addressControl.addSecuritySettings("/v1/gateway/#", _roleName, _roleName, _roleName, _roleName,
|
|
|
-// _roleName, _roleName, _roleName, _roleName, _roleName, _roleName);
|
|
|
-
|
|
|
for (GateWayInfo gateWayInfo : gateWayInfos) {
|
|
|
// 以前的权限
|
|
|
List<GateWayMqttSecurity> list = gateWayMqttSecurityDao.findByMqttInfoAndGateWayInfo(mqttInfo, gateWayInfo);
|
|
|
@@ -447,8 +440,13 @@ public class GateWayUserInfoService {
|
|
|
String userName = gateWayUserInfo.getUserName();
|
|
|
String roleName = gateWayUserInfo.getRoleName();
|
|
|
|
|
|
+ List<String> roleNames = new ArrayList<>();
|
|
|
+ roleNames.add(roleName);
|
|
|
+ roleNames.add(_roleName);
|
|
|
+
|
|
|
+ roleName = String.join(",", roleNames);
|
|
|
List<GateWayMqttSecurity> securities = new ArrayList<>();
|
|
|
- addressMatchs.stream().forEach(addressMatch -> {
|
|
|
+ for (String addressMatch : addressMatchs) {
|
|
|
GateWayMqttSecurity gateWayMqttSecurity = new GateWayMqttSecurity();
|
|
|
gateWayMqttSecurity.setUserName(userName);
|
|
|
gateWayMqttSecurity.setRoleName(roleName);
|
|
|
@@ -458,12 +456,8 @@ public class GateWayUserInfoService {
|
|
|
gateWayMqttSecurity.setMqttName(mqttInfo.getName());
|
|
|
gateWayMqttSecurity.setAddressMatch(addressMatch);
|
|
|
try {
|
|
|
- if (!roleName.equals(MqttConfig.adminRoleName)) {
|
|
|
- addressControl.addSecuritySettings(addressMatch, roleName, roleName, roleName, roleName, roleName, roleName, roleName, roleName, roleName, roleName);
|
|
|
- }
|
|
|
- addressControl.addSecuritySettings(addressMatch, _roleName, _roleName, _roleName, _roleName,
|
|
|
- _roleName, _roleName, _roleName, _roleName,
|
|
|
- _roleName, _roleName);
|
|
|
+ addressControl.addSecuritySettings(addressMatch, roleName, roleName, roleName,
|
|
|
+ roleName, roleName, roleName, roleName, roleName, roleName, roleName);
|
|
|
|
|
|
gateWayMqttSecurity.setIsSync(Boolean.TRUE);
|
|
|
gateWayMqttSecurity.setMsg("同步成功");
|
|
|
@@ -474,7 +468,7 @@ public class GateWayUserInfoService {
|
|
|
}
|
|
|
gateWayMqttSecurity.setTimeStr(DateUtils.paresTime(System.currentTimeMillis(), DateUtils.FORMAT_LONG));
|
|
|
securities.add(gateWayMqttSecurity);
|
|
|
- });
|
|
|
+ }
|
|
|
gateWayMqttSecurityDao.saveAll(securities);
|
|
|
}
|
|
|
}
|
|
|
@@ -526,6 +520,8 @@ public class GateWayUserInfoService {
|
|
|
|
|
|
List<GateWayMqttSecurity> securities = new ArrayList<>();
|
|
|
addressMatchs.stream().forEach(addressMatch -> {
|
|
|
+ gateWayMqttSecurityDao.deleteByMqttInfoAndAddressMatch(mqttInfo, addressMatch);
|
|
|
+
|
|
|
GateWayMqttSecurity gateWayMqttSecurity = new GateWayMqttSecurity();
|
|
|
gateWayMqttSecurity.setUserName(userName);
|
|
|
gateWayMqttSecurity.setRoleName(roleName);
|