Configure Extension with UiPageProvider #1
1 changed files with 4 additions and 13 deletions
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.
commit
85bd0c6572
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue