for (String privilegeDefinition : privileges) {
Matcher m = pattern.matcher(privilegeDefinition);
boolean b = m.matches();
if (b) {
String group = m.group(groupIndexInPattern);
Profile profile = Profile.valueOf(m.group(profilIndexInPattern));
if (profile != null) {
if (!LDAPConstants.ALL_GROUP_INDICATOR.equals(group)) {
if (Log.isDebugEnabled(Geonet.LDAP)) {
Log.debug(Geonet.LDAP, " Adding profile "
+ profile + " for group " + group);
}
userDetails.addPrivilege(group, profile);
profileList.add(profile);
} else {
profileList.add(profile);
}
}
} else {
Log.error(Geonet.LDAP, "LDAP privilege info '"
+ privilegeDefinition
+ "' does not match search pattern '"
+ privilegePattern + "'. Information ignored.");
}
}
Profile highestUserProfile = ProfileManager.getHighestProfile(profileList.toArray(new Profile[0]));
if (highestUserProfile != null) {
if (Log.isDebugEnabled(Geonet.LDAP)) {
Log.debug(Geonet.LDAP, " Highest user profile is "
+ highestUserProfile);
}