Configure Extension with UiPageProvider #1

Merged
kritzl merged 11 commits from addUiPageProvider into main 2026-03-31 17:53:07 +02:00
Showing only changes of commit 85bd0c6572 - Show all commits

only perform further validation, if config string isn't null

For the configAttributeSlug the further validation fails ugly otherwise
and there's generally no need to do further validation, if a config
string is null.
June 2026-03-31 15:54:39 +02:00
Signed by: june
SSH key fingerprint: SHA256:o9EAq4Y9N9K0pBQeBTqhSDrND5E7oB+60ZNx0U1yPe0

View file

@ -57,9 +57,7 @@ public class AdminUiPage implements UiPageProvider, UiPageProviderFactory<Compon
if (configAttributeSlug == null) {
hasError = true;
errorString += " • [Slug] can not be empty\n";
}
if (!slugPattern.matcher(configAttributeSlug).matches()) {
} else if (!slugPattern.matcher(configAttributeSlug).matches()) {
hasError = true;
errorString += " • [Slug] can only contain anlphanumeric characters, dash and underscore (a-z A-Z 0-9 _ - )\n";
}
@ -68,10 +66,7 @@ public class AdminUiPage implements UiPageProvider, UiPageProviderFactory<Compon
if (configAuthRole == null) {
hasError = true;
errorString += " • [Auth Role] can not be empty\n";
}
RoleModel authRole = realm.getRole(configAuthRole);
if (authRole == null) {
} else if (realm.getRole(configAuthRole) == null) {
hasError = true;
errorString += " • [Auth Role] does not exist\n";
}
@ -80,10 +75,7 @@ public class AdminUiPage implements UiPageProvider, UiPageProviderFactory<Compon
if (configMatchRole == null) {
hasError = true;
errorString += " • [Match Role] can not be empty\n";
}
RoleModel matchRole = realm.getRole(configMatchRole);
if (matchRole == null) {
} else if (realm.getRole(configMatchRole) == null) {
hasError = true;
errorString += " • [Match Role] does not exist\n";
}
@ -94,8 +86,7 @@ public class AdminUiPage implements UiPageProvider, UiPageProviderFactory<Compon
if (configAttributeGroup == null) {
hasError = true;
errorString += " • [Attribute Group] can not be empty\n";
}
if (!upconfig.getGroups().stream().anyMatch(g -> g.getName().equals(configAttributeGroup))) {
} else if (!upconfig.getGroups().stream().anyMatch(g -> g.getName().equals(configAttributeGroup))) {
hasError = true;
errorString += " • [Attribute Group] does not exist\n";
}