Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Minor

Christian Bauerb1d28fe295f9
diff --git a/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetEditActivity.java b/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetEditActivity.java
index 033e0b711..499c00a83 100644
--- a/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetEditActivity.java
+++ b/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetEditActivity.java
@@ -191,6 +191,7 @@ public class AssetEditActivity
@Override
public void onMapClicked(double lng, double lat) {
selectedCoordinates = new double[]{lng, lat};
+ view.hideMapPopup();
view.showMapPopup(lng, lat, environment.getMessages().selectedLocation());
view.setLocation(selectedCoordinates);
}
diff --git a/manager/client/src/main/java/org/openremote/manager/client/service/BasicSecurityService.java b/manager/client/src/main/java/org/openremote/manager/client/service/BasicSecurityService.java
deleted file mode 100644
index a77da6c3d..000000000
--- a/manager/client/src/main/java/org/openremote/manager/client/service/BasicSecurityService.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2016, OpenRemote Inc.
- *
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.openremote.manager.client.service;
-
-import com.google.gwt.user.client.Window;
-import elemental.client.Browser;
-import org.openremote.manager.shared.http.RequestParams;
-import org.openremote.model.Constants;
-
-import java.util.logging.Logger;
-
-/**
- * Basic authorization, any user has all roles and is superuser.
- */
-public class BasicSecurityService implements SecurityService {
-
- private static final Logger LOG = Logger.getLogger(BasicSecurityService.class.getName());
-
- protected final String username;
- protected final String password;
-
- public BasicSecurityService(String username, String password) {
- this.username = username;
- this.password = password;
- }
-
- @Override
- public String getUsername() {
- return username;
- }
-
- @Override
- public String getFullName() {
- return username;
- }
-
- @Override
- public void logout() {
- LOG.fine("Logging out...");
- String url = Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/" + Constants.MASTER_REALM;
- Window.Location.assign(url);
- }
-
- @Override
- public boolean isSuperUser() {
- return true;
- }
-
- @Override
- public boolean hasRealmRole(String role) {
- return true;
- }
-
- @Override
- public boolean hasResourceRole(String role, String resource) {
- return true;
- }
-
- @Override
- public boolean hasResourceRoleOrIsSuperUser(String role, String resource) {
- return true;
- }
-
- @Override
- public String getAuthenticatedRealm() {
- return Constants.MASTER_REALM;
- }
-
- @Override
- public <OUT> void setCredentials(RequestParams<OUT> requestParams) {
- requestParams.setUsername(username);
- requestParams.setPassword(password);
- }
-
- @Override
- public String setCredentials(String serviceUrl) {
- String authenticatedServiceUrl = serviceUrl
- + "?Auth-Realm=" + getAuthenticatedRealm()
- + "&Authorization=Basic " + Browser.getWindow().btoa(username + ":" + password);
- return authenticatedServiceUrl;
- }
-
- @Override
- public boolean isUserTenantAdminEnabled() {
- return false;
- }
-}
diff --git a/manager/client/src/main/java/org/openremote/manager/client/service/KeycloakSecurityService.java b/manager/client/src/main/java/org/openremote/manager/client/service/KeycloakSecurityService.java
deleted file mode 100644
index 6b528a8c7..000000000
--- a/manager/client/src/main/java/org/openremote/manager/client/service/KeycloakSecurityService.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2016, OpenRemote Inc.
- *
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.openremote.manager.client.service;
-
-import org.openremote.manager.client.app.OpenRemoteApp;
-import org.openremote.manager.client.interop.keycloak.AuthToken;
-import org.openremote.manager.client.interop.keycloak.Keycloak;
-import org.openremote.manager.shared.http.RequestParams;
-import org.openremote.model.Constants;
-import org.openremote.model.event.bus.EventBus;
-
-import java.util.logging.Logger;
-
-public class KeycloakSecurityService implements SecurityService {
-
- private static final Logger LOG = Logger.getLogger(KeycloakSecurityService.class.getName());
-
- protected final OpenRemoteApp openRemoteApp;
- protected final Keycloak keycloak;
-
- public KeycloakSecurityService(OpenRemoteApp openRemoteApp,
- CookieService cookieService,
- EventBus eventBus) {
- this.openRemoteApp = openRemoteApp;
- this.keycloak = openRemoteApp.getKeycloak();
- }
-
- @Override
- public String getUsername() {
- return getParsedToken().getPreferredUsername();
- }
-
- @Override
- public String getFullName() {
- return getParsedToken().getName();
- }
-
- @Override
- public void logout() {
- openRemoteApp.logout();
- }
-
- @Override
- public boolean isSuperUser() {
- return getAuthenticatedRealm().equals(Constants.MASTER_REALM) && hasRealmRole(Constants.REALM_ADMIN_ROLE);
- }
-
- @Override
- public boolean hasRealmRole(String role) {
- return keycloak.hasRealmRole(role);
- }
-
- @Override
- public boolean hasResourceRole(String role, String resource) {
- return keycloak.hasResourceRole(role, resource);
- }
-
- @Override
- public boolean hasResourceRoleOrIsSuperUser(String role, String resource) {
- return hasResourceRole(role, resource) || isSuperUser();
- }
-
- @Override
- public String getAuthenticatedRealm() {
- return keycloak.realm;
- }
-
- @Override
- public <OUT> void setCredentials(RequestParams<OUT> requestParams) {
- requestParams.withBearerAuth(getToken());
- }
-
- @Override
- public String setCredentials(String serviceUrl) {
- String authenticatedServiceUrl = serviceUrl
- + "?Auth-Realm=" + getAuthenticatedRealm()
- + "&Authorization=Bearer " + getToken();
- return authenticatedServiceUrl;
- }
-
- @Override
- public boolean isUserTenantAdminEnabled() {
- return true;
- }
-
- protected String getToken() {
- return keycloak.token;
- }
-
- protected AuthToken getParsedToken() {
- return keycloak.tokenParsed;
- }
-
- protected void onAuthSuccess(Runnable fn) {
- keycloak.onAuthSuccess = () -> fn.run();
- }
-
- protected void onAuthLogout(Runnable fn) {
- keycloak.onAuthLogout = () -> fn.run();
- }
-
-}
diff --git a/manager/client/src/main/java/org/openremote/manager/client/service/SecurityService.java b/manager/client/src/main/java/org/openremote/manager/client/service/SecurityService.java
deleted file mode 100644
index 148dc3cae..000000000
--- a/manager/client/src/main/java/org/openremote/manager/client/service/SecurityService.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2016, OpenRemote Inc.
- *
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.openremote.manager.client.service;
-
-import org.openremote.manager.shared.http.RequestParams;
-
-public interface SecurityService {
-
- String getUsername();
-
- String getFullName();
-
- void logout();
-
- /**
- * @return <code>true</code> if the user is authenticated in the "master" realm and has the realm role "admin".
- */
- boolean isSuperUser();
-
- boolean hasRealmRole(String role);
-
- boolean hasResourceRole(String role, String resource);
-
- boolean hasResourceRoleOrIsSuperUser(String role, String resource);
-
- String getAuthenticatedRealm();
-
- <OUT> void setCredentials(RequestParams<OUT> requestParams);
-
- String setCredentials(String serviceUrl);
-
- boolean isUserTenantAdminEnabled();
-}
diff --git a/manager/client/src/main/java/org/openremote/manager/client/widget/FormOutputLocation.java b/manager/client/src/main/java/org/openremote/manager/client/widget/FormOutputLocation.java
index 0efb2875f..1043f0895 100644
--- a/manager/client/src/main/java/org/openremote/manager/client/widget/FormOutputLocation.java
+++ b/manager/client/src/main/java/org/openremote/manager/client/widget/FormOutputLocation.java
@@ -68,12 +68,12 @@ public class FormOutputLocation extends Composite {
// Rounding to 5 decimals gives us precision of about 1 meter, should be enough
if (reversed) {
coordinatesLabel.setText(round(coordinates[0], 5) + " " + round(coordinates[1], 5));
- toggleButton.getUpFace().setText("Lng|Lat");
- toggleButton.getDownFace().setText("Lng|Lat");
+ toggleButton.getUpFace().setText("Lng | Lat");
+ toggleButton.getDownFace().setText("Lng | Lat");
} else {
coordinatesLabel.setText(round(coordinates[1], 5) + " " + round(coordinates[0], 5));
- toggleButton.getUpFace().setText("Lat|Lng");
- toggleButton.getDownFace().setText("Lat|Lng");
+ toggleButton.getUpFace().setText("Lat | Lng");
+ toggleButton.getDownFace().setText("Lat | Lng");
}
}
protected String round(double d, int places) {