public LDAPContext(SettingManager sm) {
    String prefix = "system/ldap";

    use = sm.getValueAsBool(prefix + "/use");
    host = sm.getValue(prefix + "/host");
    port = sm.getValueAsInt(prefix + "/port");
    defProfile = sm.getValue(prefix + "/defaultProfile");
    defGroup = sm.getValue(prefix + "/defaultGroup");
    baseDN = sm.getValue(prefix + "/distinguishedNames/base");
    usersDN = sm.getValue(prefix + "/distinguishedNames/users");
    nameAttr = sm.getValue(prefix + "/userAttribs/name");
    profileAttr = sm.getValue(prefix + "/userAttribs/profile");
    emailAttr = "mail"; // TODO make it configurable
    uidAttr = sm.getValue(prefix + "/uidAttr");
    groupAttr = sm.getValue(prefix + "/userAttribs/group");

    if (profileAttr.trim().length() == 0) profileAttr = null;

    if (groupAttr.trim().length() == 0) groupAttr = null;

    // --- init set of allowed profiles

    profiles.add("Hoofdeditor");
    profiles.add("Editor");
    profiles.add("RegisteredUser");
    profiles.add("UserAdmin");
    profiles.add("Monitor");
    profiles.add("Administrator");
  }
  private String getSiteId() {
    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    SettingManager sm = gc.getBean(SettingManager.class);

    return sm.getValue("system/site/siteId");
  }