avoid more than 3 nested if/switch/try blocks
Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
@@ -185,18 +185,22 @@ public final class SpPermission {
|
|||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
try {
|
try {
|
||||||
final String role = (String) field.get(null);
|
final String role = (String) field.get(null);
|
||||||
if (!(exclusionRoles.contains(role))) {
|
addIfNotExcluded(exclusionRoles, allPermissions, role);
|
||||||
allPermissions.add(role);
|
|
||||||
}
|
|
||||||
} catch (final IllegalAccessException e) {
|
} catch (final IllegalAccessException e) {
|
||||||
LOGGER.error(e.getMessage(), e);
|
LOGGER.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return allPermissions;
|
return allPermissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void addIfNotExcluded(final Collection<String> exclusionRoles, final List<String> allPermissions,
|
||||||
|
final String role) {
|
||||||
|
if (!(exclusionRoles.contains(role))) {
|
||||||
|
allPermissions.add(role);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains all the spring security evaluation expressions for the
|
* Contains all the spring security evaluation expressions for the
|
||||||
* {@link PreAuthorize} annotation for method security.
|
* {@link PreAuthorize} annotation for method security.
|
||||||
|
|||||||
Reference in New Issue
Block a user