Skip to content

armgit / core

Public Imported from GitHub
0

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

Cleanup of AbstractKeycloakSetup user attributes

Rich Turner8c9f83f8aa96
diff --git a/manager/src/main/java/org/openremote/manager/setup/AbstractKeycloakSetup.java b/manager/src/main/java/org/openremote/manager/setup/AbstractKeycloakSetup.java
index 2f4fb4ac3..6f2bbe3c5 100644
--- a/manager/src/main/java/org/openremote/manager/setup/AbstractKeycloakSetup.java
+++ b/manager/src/main/java/org/openremote/manager/setup/AbstractKeycloakSetup.java
@@ -93,8 +93,12 @@ public abstract class AbstractKeycloakSetup implements Setup {
user.setLastName(lastName);
user.setEmail(email);
user.setEnabled(enabled);
- user.setAttribute(KEYCLOAK_USER_ATTRIBUTE_EMAIL_NOTIFICATIONS_DISABLED, Boolean.toString(emailNotificationsDisabled));
- user.setAttribute(KEYCLOAK_USER_ATTRIBUTE_PUSH_NOTIFICATIONS_DISABLED, Boolean.toString(pushNotificationsDisabled));
+ if (emailNotificationsDisabled) {
+ user.setAttribute(KEYCLOAK_USER_ATTRIBUTE_EMAIL_NOTIFICATIONS_DISABLED, "true");
+ }
+ if (pushNotificationsDisabled) {
+ user.setAttribute(KEYCLOAK_USER_ATTRIBUTE_PUSH_NOTIFICATIONS_DISABLED, "true");
+ }
user = keycloakProvider.createUpdateUser(realm, user, password);
if (user == null) {
return null;
diff --git a/model/src/main/java/org/openremote/model/security/User.java b/model/src/main/java/org/openremote/model/security/User.java
index 0621cc65c..3bc0c3acb 100644
--- a/model/src/main/java/org/openremote/model/security/User.java
+++ b/model/src/main/java/org/openremote/model/security/User.java
@@ -186,6 +186,13 @@ public class User {
return this;
}
+ public User removeAttribute(String key) {
+ if (attributes != null) {
+ attributes.removeIf(attr -> attr.getName().equals(key));
+ }
+ return this;
+ }
+
public User setServiceAccount(boolean serviceAccount) {
if (username != null) {
username = serviceAccount ? SERVICE_ACCOUNT_PREFIX + username.replace(SERVICE_ACCOUNT_PREFIX, "") : username.replace(SERVICE_ACCOUNT_PREFIX, "");
diff --git a/ui/component/or-attribute-input/tsconfig.json b/ui/component/or-attribute-input/tsconfig.json
index b3701c2e9..c28121e2d 100644
--- a/ui/component/or-attribute-input/tsconfig.json
+++ b/ui/component/or-attribute-input/tsconfig.json
@@ -6,8 +6,7 @@
"rootDir": "src"
},
"include": [
- "./src",
- "../or-map/@types"
+ "./src"
],
"references": [
{ "path": "../core" },
diff --git a/ui/component/or-attribute-picker/tsconfig.json b/ui/component/or-attribute-picker/tsconfig.json
index 614de2aba..329f08374 100644
--- a/ui/component/or-attribute-picker/tsconfig.json
+++ b/ui/component/or-attribute-picker/tsconfig.json
@@ -6,8 +6,7 @@
"rootDir": "src"
},
"include": [
- "./src",
- "../or-map/@types"
+ "./src"
],
"references": [
{ "path": "../core" },