Skip to content
Snippets Groups Projects
Commit 670f5116 authored by Alfredo Chissotti's avatar Alfredo Chissotti
Browse files

scenari + bridge con topic corretti

parent 6871aca1
No related branches found
No related tags found
No related merge requests found
......@@ -75,6 +75,9 @@ public class InstallHandler implements HttpHandler {
String usr = userObj.getString("user");
if (user.equals(usr)) {//se l'utente e' colui che ha fatto la chiamata, l'ho gia' sistemato => passo al successivo
didUserSetHimself = true;
if(!userObj.getString("role").equals("A")){//the user didn't set himself as an admin, we have to correct that
arrUsers.put(k-1, userObj.put("role","A"));//new JSONObject().put("user", usr).put("role", "A").put("passwd", userObj.getString("passwd")));
}
continue;
}
if (userObj.getString("role").equals("A")) {
......@@ -84,8 +87,8 @@ public class InstallHandler implements HttpHandler {
} else
System.err.println(userObj.toString());
}
if(!didUserSetHimself){
arrUsers.put(new JSONObject("{\"role\":\"A\",\"passwd\":\""+user+"\",\"user\":\"" + user + "\"}"));
if(!didUserSetHimself){//l'utente non si e' settato lui stesso come amministratore, lo faccio io
arrUsers.put(new JSONObject().put("user", user).put("role", "A").put("passwd", user));
j.put("users", arrUsers);
}
......
mosquitto_sub -u gruppo2 -P funziona -t '#' -h luci.local -v
mosquitto_sub -u gruppo2 -P funziona -h luci.local -p 8883 --cafile caGruppo2.crt --cert clientGruppo2.crt --key clientGruppo2.key -t '#' -v
......@@ -2,7 +2,7 @@
cd keycloak-19.0.1 && bash keycloak.bash &
cd cloudAppManager && bash cloudappmanager.bash &
#cd domainManager && bash domain.bash &
cd domainManager && bash domain.bash &
cd webserver && bash server.bash &
# wait until <Ctrl>+C is pressed without then closing the process
......
OFF
#!/bin/bash
if [ ! -d "/home/debian/hat_home" ]; then mkdir /home/debian/hat_home; fi
#!/bin/bash
status="OFF"
running=$(/usr/bin/pgrep scenari.Scenari)
if [ -f "/home/debian/CONFIG/scenariMicroservizio/STATUS" ]; then status=$(cat /home/debian/CONFIG/scenariMicroservizio/STATUS); fi
if [ ! -z "$running" ]; then status="OFF"; fi
if [ $status == "ON" ]; then (java -classpath /home/debian/CONFIG/scenariMicroservizio:/home/debian/CONFIG/scenariMicroservizio/org.eclipse.paho.client.mqttv3_1.2.5.jar:/home/debian/CONFIG/scenariMicroservizio/org.json-1.0.0.v201011060100.jar:/home/debian/CONFIG/scenariMicroservizio/bcprov-jdk13-167.jar:/home/debian/CONFIG/scenariMicroservizio/bcpkix-jdk13-167.jar /home/debian/CONFIG/scenariMicroservizio/bin/code.Antifurto &>/dev/null&); fi
#!/bin/bash
status="NONE"
if [ -f "/home/debian/CONFIG/scenariMicroservizio/STATUS" ]; then status=$(cat /home/debian/CONFIG/scenariMicroservizio/STATUS); fi
if [ $status == "OFF" ]; then /home/debian/bin/stopag Scenari; fi
connection pissirBridgeGruppo2
address smartcity-challenge.edu-al.unipmn.it:8883
bridge_cafile /usr/local/etc/mosquitto/ca_certificates/ca_certificate.pem
bridge_tls_version tlsv1.2
try_private false
remote_username pissir
remote_password pissir2020
topic rpc/gruppo2/luci/luci out 2
topic to/gruppo2/luci/luci/# out 2
topic from/gruppo2/luci/luci/# in 2
topic rpc/gruppo2/luci/scenari out 2
topic to/gruppo2/luci/scenari/# out 2
topic from/gruppo2/luci/scenari/# in 2
topic conf/gruppo2/luci/scenari/# out 2
topic rpc/gruppo2/luci/antifurto out 2
topic to/gruppo2/luci/antifurto/# out 2
topic from/gruppo2/luci/antifurto/# in 2
topic conf/gruppo2/luci/antifurto/# out 2
topic from/gruppo2/luci/gpio/# out 2
......@@ -133,14 +133,15 @@ class App {
for(const c of checkboxarr){
if(c.checked) {
checks.push(c.value);
topicsArr.push({role:"U", topic: `to/${domainName}/luci/${c.value}/#`});
topicsArr.push({role:"U", topic: `from/${domainName}/luci/${c.value}/#`});
topicsArr.push({role:"U", topic: `rpc/${domainName}/luci/${c.value}/#`});
// change bbgpio to gpio to enable the correct topics
topicsArr.push({role:"U", topic: `to/${domainName}/luci/${c.value == 'bbgpio' ? 'gpio' : c.value}/#`});
topicsArr.push({role:"U", topic: `from/${domainName}/luci/${c.value == 'bbgpio' ? 'gpio' : c.value}/#`});
topicsArr.push({role:"U", topic: `rpc/${domainName}/luci/${c.value == 'bbgpio' ? 'gpio' : c.value}/#`});
}
}
const checkboxDiv = document.getElementById('checkbox-div');
if(checks.length === 0){
errors++;
checkboxDiv.classList.add('is-invalid');
......@@ -148,14 +149,24 @@ class App {
document.getElementById('valid-services').innerHTML = '';
document.getElementById('invalid-services').innerHTML = 'Selezionare almeno un servizio';
}
else {
if(checks.includes('Scenari') && !checks.includes('Luci')) {
else {
if(checks.includes('scenari') && !checks.includes('luci')) {
// scenari deve avere anche luci per funzionare
errors++;
checkboxDiv.classList.add('is-invalid');
checkboxDiv.classList.remove('is-valid');
document.getElementById('valid-services').innerHTML = '';
document.getElementById('invalid-services').innerHTML = 'Non e\' possibile avere il microservizio degli scenari senza il microservizio delle luci';
} else {
}
else if ((checks.includes('luci') || checks.includes('scenari') || checks.includes('antifurto')) && !checks.includes('bbgpio')) {
// i nostri microservizi necessitano della bbgpio
errors++;
checkboxDiv.classList.add('is-invalid');
checkboxDiv.classList.remove('is-valid');
document.getElementById('valid-services').innerHTML = '';
document.getElementById('invalid-services').innerHTML = 'Non e\' possibile avere il microservizio delle luci, degli scenari o dell\'antifurto senza il bbgpio';
}
else {
checkboxDiv.classList.add('is-valid');
checkboxDiv.classList.remove('is-invalid');
document.getElementById('valid-services').innerHTML = 'Ok';
......@@ -222,7 +233,7 @@ class App {
});
i++;
}
if(errors > 0) {
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment