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.
This commit is contained in:
parent
5e791af057
commit
85bd0c6572
1 changed files with 4 additions and 13 deletions
|
|
@ -57,9 +57,7 @@ public class AdminUiPage implements UiPageProvider, UiPageProviderFactory<Compon
|
||||||
if (configAttributeSlug == null) {
|
if (configAttributeSlug == null) {
|
||||||
hasError = true;
|
hasError = true;
|
||||||
errorString += " • [Slug] can not be empty\n";
|
errorString += " • [Slug] can not be empty\n";
|
||||||
}
|
} else if (!slugPattern.matcher(configAttributeSlug).matches()) {
|
||||||
|
|
||||||
if (!slugPattern.matcher(configAttributeSlug).matches()) {
|
|
||||||
hasError = true;
|
hasError = true;
|
||||||
errorString += " • [Slug] can only contain anlphanumeric characters, dash and underscore (a-z A-Z 0-9 _ - )\n";
|
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) {
|
if (configAuthRole == null) {
|
||||||
hasError = true;
|
hasError = true;
|
||||||
errorString += " • [Auth Role] can not be empty\n";
|
errorString += " • [Auth Role] can not be empty\n";
|
||||||
}
|
} else if (realm.getRole(configAuthRole) == null) {
|
||||||
|
|
||||||
RoleModel authRole = realm.getRole(configAuthRole);
|
|
||||||
if (authRole == null) {
|
|
||||||
hasError = true;
|
hasError = true;
|
||||||
errorString += " • [Auth Role] does not exist\n";
|
errorString += " • [Auth Role] does not exist\n";
|
||||||
}
|
}
|
||||||
|
|
@ -80,10 +75,7 @@ public class AdminUiPage implements UiPageProvider, UiPageProviderFactory<Compon
|
||||||
if (configMatchRole == null) {
|
if (configMatchRole == null) {
|
||||||
hasError = true;
|
hasError = true;
|
||||||
errorString += " • [Match Role] can not be empty\n";
|
errorString += " • [Match Role] can not be empty\n";
|
||||||
}
|
} else if (realm.getRole(configMatchRole) == null) {
|
||||||
|
|
||||||
RoleModel matchRole = realm.getRole(configMatchRole);
|
|
||||||
if (matchRole == null) {
|
|
||||||
hasError = true;
|
hasError = true;
|
||||||
errorString += " • [Match Role] does not exist\n";
|
errorString += " • [Match Role] does not exist\n";
|
||||||
}
|
}
|
||||||
|
|
@ -94,8 +86,7 @@ public class AdminUiPage implements UiPageProvider, UiPageProviderFactory<Compon
|
||||||
if (configAttributeGroup == null) {
|
if (configAttributeGroup == null) {
|
||||||
hasError = true;
|
hasError = true;
|
||||||
errorString += " • [Attribute Group] can not be empty\n";
|
errorString += " • [Attribute Group] can not be empty\n";
|
||||||
}
|
} else if (!upconfig.getGroups().stream().anyMatch(g -> g.getName().equals(configAttributeGroup))) {
|
||||||
if (!upconfig.getGroups().stream().anyMatch(g -> g.getName().equals(configAttributeGroup))) {
|
|
||||||
hasError = true;
|
hasError = true;
|
||||||
errorString += " • [Attribute Group] does not exist\n";
|
errorString += " • [Attribute Group] does not exist\n";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue