Skip to content

Commit

Permalink
Closes kadai-io#37 - Address MR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
CRoberto1926 committed Oct 10, 2024
1 parent 3fb0ef3 commit ae6d535
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public List<AccessIdRepresentationModel> searchUsersByNameOrAccessIdInUserRole(
andFilter.and(new EqualsFilter(getUserSearchFilterName(), getUserSearchFilterValue()));

final List<AccessIdRepresentationModel> accessIds =
searchAndDebugLog(
search(
getUserSearchBase(),
andFilter.encode(),
SearchControls.SUBTREE_SCOPE,
Expand Down Expand Up @@ -187,7 +187,7 @@ public List<User> searchUsersInUserRole() {
});

final List<User> users =
searchAndDebugLog(
search(
getUserSearchBase(),
userOrGroupFilter.encode(),
SearchControls.SUBTREE_SCOPE,
Expand Down Expand Up @@ -219,7 +219,7 @@ public List<AccessIdRepresentationModel> searchUsersByNameOrAccessId(final Strin
andFilter.and(orFilter);

List<AccessIdRepresentationModel> accessIds =
searchAndDebugLog(
search(
getUserSearchBase(),
andFilter.encode(),
SearchControls.SUBTREE_SCOPE,
Expand Down Expand Up @@ -250,7 +250,7 @@ public List<AccessIdRepresentationModel> getUsersByAccessId(final String accessI
};

List<AccessIdRepresentationModel> accessIds =
searchAndDebugLog(
search(
getUserSearchBase(),
andFilter.encode(),
SearchControls.SUBTREE_SCOPE,
Expand Down Expand Up @@ -287,7 +287,7 @@ public List<AccessIdRepresentationModel> searchGroupsByName(final String name)
andFilter2.and(andFilter);

List<AccessIdRepresentationModel> accessIds =
searchAndDebugLog(
search(
getGroupSearchBase(),
andFilter2.encode(),
SearchControls.SUBTREE_SCOPE,
Expand Down Expand Up @@ -363,7 +363,7 @@ public List<AccessIdRepresentationModel> searchPermissionsByName(final String na
andFilter2.and(andFilter);

List<AccessIdRepresentationModel> accessIds =
searchAndDebugLog(
search(
getPermissionSearchBase(),
andFilter2.encode(),
SearchControls.SUBTREE_SCOPE,
Expand Down Expand Up @@ -401,7 +401,7 @@ public AccessIdRepresentationModel lookupAccessIdByDn(final String name)
String[] attributes = getLookUpUserAndGroupAndPermissionAttributesToReturn();
DnContextMapper mapper = new DnContextMapper();

AccessIdRepresentationModel accessId = lookupAndDebugLog(dn, attributes, mapper);
AccessIdRepresentationModel accessId = lookup(dn, attributes, mapper);

LOGGER.debug(
"LDAP lookup for access id by dn completed! [name={}, accessId={}]",
Expand Down Expand Up @@ -440,7 +440,7 @@ public List<AccessIdRepresentationModel> searchGroupsAccessIdIsMemberOf(final St
String[] userAttributesToReturn = {getUserIdAttribute(), getGroupNameAttribute()};

List<AccessIdRepresentationModel> accessIds =
searchAndDebugLog(
search(
getGroupSearchBase(),
andFilter2.encode(),
SearchControls.SUBTREE_SCOPE,
Expand Down Expand Up @@ -485,7 +485,7 @@ public List<AccessIdRepresentationModel> searchPermissionsAccessIdHas(final Stri
String[] userAttributesToReturn = {getUserIdAttribute(), getUserPermissionsAttribute()};

List<AccessIdRepresentationModel> accessIds =
searchAndDebugLog(
search(
getPermissionSearchBase(),
andFilter2.encode(),
SearchControls.SUBTREE_SCOPE,
Expand Down Expand Up @@ -553,7 +553,7 @@ public boolean validateAccessId(final String name) throws InvalidNameException {
andFilter.and(orFilter);

final List<AccessIdRepresentationModel> accessIds =
searchAndDebugLog(
search(
getUserSearchBase(),
andFilter.encode(),
SearchControls.SUBTREE_SCOPE,
Expand Down Expand Up @@ -852,7 +852,7 @@ void testMinSearchForLength(final String name) throws InvalidArgumentException {
}
}

private AccessIdRepresentationModel lookupAndDebugLog(
private AccessIdRepresentationModel lookup(
LdapName dn, String[] attributes, DnContextMapper mapper) {

String mapperSimpleName = mapper.getClass().getSimpleName();
Expand All @@ -875,7 +875,7 @@ private AccessIdRepresentationModel lookupAndDebugLog(
return accessId;
}

private <T> List<T> searchAndDebugLog(
private <T> List<T> search(
String base,
String filter,
int searchScope,
Expand Down Expand Up @@ -947,7 +947,7 @@ private List<String> searchDnForUserAccessId(String accessId) {
andFilter.and(orFilter);

List<String> dns =
searchAndDebugLog(
search(
getUserSearchBase(),
andFilter.encode(),
SearchControls.SUBTREE_SCOPE,
Expand Down Expand Up @@ -979,7 +979,7 @@ private List<String> searchDnForPermissionAccessId(String accessId) {
andFilterPermission2.and(andFilter);

List<String> dns =
searchAndDebugLog(
search(
getPermissionSearchBase(),
andFilterPermission2.encode(),
SearchControls.SUBTREE_SCOPE,
Expand Down Expand Up @@ -1010,7 +1010,7 @@ private List<String> searchDnForGroupAccessId(String accessId) {
andFilter2.and(andFilter);

List<String> dns =
searchAndDebugLog(
search(
getPermissionSearchBase(),
andFilter.encode(),
SearchControls.SUBTREE_SCOPE,
Expand Down

0 comments on commit ae6d535

Please sign in to comment.