CR-2124 Fix OPENDJ-1016 Control panel does not follow static group recommendation from documentation
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | |
| | | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.quicksetup.ui.UIFactory; |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | | /** |
| | | * This class is used as a cache containing the icons that are used by the |
| | |
| | | |
| | | |
| | | private static final String[] ICON_PATH = { |
| | | "person", "ds-user.png", |
| | | "organization", "ds-folder.png", |
| | | "organizationalunit", "ds-ou.png", |
| | | "groupofuniquenames", "ds-group.png", |
| | | "groupofurls", "ds-group.png", |
| | | "ds-virtual-static-group", "ds-group.png", |
| | | ServerConstants.OC_PERSON, "ds-user.png", |
| | | ServerConstants.OC_ORGANIZATION, "ds-folder.png", |
| | | ServerConstants.OC_ORGANIZATIONAL_UNIT_LC, "ds-ou.png", |
| | | ServerConstants.OC_GROUP_OF_NAMES_LC, "ds-group.png", |
| | | ServerConstants.OC_GROUP_OF_ENTRIES_LC, "ds-group.png", |
| | | ServerConstants.OC_GROUP_OF_UNIQUE_NAMES_LC, "ds-group.png", |
| | | ServerConstants.OC_GROUP_OF_URLS_LC, "ds-group.png", |
| | | ServerConstants.OC_VIRTUAL_STATIC_GROUP, "ds-group.png", |
| | | "passwordpolicy", "ds-ppol.png" |
| | | }; |
| | | |
| | | private static final String[] DESCRIPTION = { |
| | | "person", INFO_PERSON_ICON_DESCRIPTION.get().toString(), |
| | | "organization", INFO_ORGANIZATION_ICON_DESCRIPTION.get().toString(), |
| | | "organizationalunit", |
| | | ServerConstants.OC_PERSON, INFO_PERSON_ICON_DESCRIPTION.get().toString(), |
| | | ServerConstants.OC_ORGANIZATION, INFO_ORGANIZATION_ICON_DESCRIPTION.get() |
| | | .toString(), |
| | | ServerConstants.OC_ORGANIZATIONAL_UNIT_LC, |
| | | INFO_ORGANIZATIONAL_UNIT_ICON_DESCRIPTION.get().toString(), |
| | | "groupofuniquenames", INFO_STATIC_GROUP_ICON_DESCRIPTION.get().toString(), |
| | | "groupofurls", INFO_DYNAMIC_GROUP_ICON_DESCRIPTION.get().toString(), |
| | | "ds-virtual-static-group", |
| | | ServerConstants.OC_GROUP_OF_NAMES_LC, INFO_STATIC_GROUP_ICON_DESCRIPTION |
| | | .get().toString(), |
| | | ServerConstants.OC_GROUP_OF_ENTRIES_LC, INFO_STATIC_GROUP_ICON_DESCRIPTION |
| | | .get().toString(), |
| | | ServerConstants.OC_GROUP_OF_UNIQUE_NAMES_LC, |
| | | INFO_STATIC_GROUP_ICON_DESCRIPTION.get().toString(), |
| | | ServerConstants.OC_GROUP_OF_URLS_LC, INFO_DYNAMIC_GROUP_ICON_DESCRIPTION |
| | | .get().toString(), |
| | | ServerConstants.OC_VIRTUAL_STATIC_GROUP, |
| | | INFO_VIRTUAL_STATIC_GROUP_ICON_DESCRIPTION.get().toString(), |
| | | "passwordpolicy", INFO_PASSWORD_POLICY_ICON_DESCRIPTION.get().toString() |
| | | }; |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | ctls.setSearchScope(SearchControls.OBJECT_SCOPE); |
| | | ctls.setReturningAttributes( |
| | | new String[] { |
| | | ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME, |
| | | ServerConstants.ATTR_MEMBER, |
| | | ServerConstants.ATTR_UNIQUE_MEMBER |
| | | }); |
| | | String filter = BrowserController.ALL_OBJECTS_FILTER; |
| | |
| | | |
| | | try |
| | | { |
| | | String memberAttr = ServerConstants.ATTR_MEMBER; |
| | | while (result.hasMore()) |
| | | { |
| | | SearchResult sr = result.next(); |
| | | Set<String> objectClasses = |
| | | ConnectionUtils.getValues(sr, ServerConstants |
| | | .OBJECTCLASS_ATTRIBUTE_TYPE_NAME); |
| | | if (objectClasses.contains(ServerConstants.OC_GROUP_OF_UNIQUE_NAMES)) |
| | | { |
| | | memberAttr = ServerConstants.ATTR_UNIQUE_MEMBER; |
| | | } |
| | | Set<String> values = |
| | | ConnectionUtils.getValues(sr, ServerConstants.ATTR_UNIQUE_MEMBER); |
| | | ConnectionUtils.getValues(sr, memberAttr); |
| | | Set<String> dnsToAdd = new LinkedHashSet<String>(); |
| | | if (values != null) |
| | | { |
| | |
| | | if (dnsToAdd.size() > 0) |
| | | { |
| | | Attribute attribute = |
| | | new BasicAttribute(ServerConstants.ATTR_UNIQUE_MEMBER); |
| | | new BasicAttribute(memberAttr); |
| | | for (String dn : dnsToAdd) |
| | | { |
| | | attribute.add(dn); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | | /** |
| | | * The dialog that is displayed when we want to add entries to a set of groups. |
| | |
| | | errors.add( |
| | | ERR_CTRL_PANEL_GROUP_COULD_NOT_BE_FOUND.get(groupDn)); |
| | | } |
| | | else if (!hasObjectClass(groupDn, "groupOfUniqueNames")) |
| | | else if (!hasObjectClass(groupDn, ServerConstants.OC_GROUP_OF_NAMES, |
| | | ServerConstants.OC_GROUP_OF_ENTRIES, |
| | | ServerConstants.OC_GROUP_OF_UNIQUE_NAMES)) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_NOT_A_STATIC_GROUP.get(groupDn)); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | break; |
| | | case STATIC_GROUPS: |
| | | filterAttribute.setSelectedItem(LDAP_FILTER); |
| | | super.filter.setText("objectClass=groupOfUniqueNames"); |
| | | super.filter.setText("(|(objectClass=groupOfNames)" + |
| | | "(objectClass=groupOfEntries)(objectClass=groupOfUniqueNames))"); |
| | | break; |
| | | case DEFAULT: |
| | | Object o = filterAttribute.getItemAt(0); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | protected String getLDIF() |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append("dn: "+dn.getText()+"\n"); |
| | | sb.append("dn: ").append(dn.getText()).append("\n"); |
| | | |
| | | String[] attrNames = {"cn", "description"}; |
| | | JTextField[] textFields = {name, description}; |
| | |
| | | String value = textFields[i].getText().trim(); |
| | | if (value.length() > 0) |
| | | { |
| | | sb.append(attrNames[i]+": "+value+"\n"); |
| | | sb.append(attrNames[i]).append(": ").append(value).append("\n"); |
| | | } |
| | | } |
| | | |
| | | sb.append("objectclass: top\n"); |
| | | if (staticGroup.isSelected()) |
| | | { |
| | | sb.append("objectClass: "+ServerConstants.OC_GROUP_OF_UNIQUE_NAMES); |
| | | sb.append("objectClass: ").append(ServerConstants.OC_GROUP_OF_NAMES); |
| | | String[] members = staticMembers.getText().split("\n"); |
| | | LinkedHashSet<DN> dns = new LinkedHashSet<DN>(); |
| | | for (String member : members) |
| | |
| | | |
| | | for (DN dn : dns) |
| | | { |
| | | sb.append("\n"+ServerConstants.ATTR_UNIQUE_MEMBER+": "+dn.toString()); |
| | | sb.append("\n").append(ServerConstants.ATTR_MEMBER) |
| | | .append(": ").append(dn); |
| | | } |
| | | } |
| | | else if (dynamicGroup.isSelected()) |
| | | { |
| | | sb.append("objectClass: "+ServerConstants.OC_GROUP_OF_URLS+"\n"); |
| | | sb.append(ServerConstants.ATTR_MEMBER_URL+": "+filter.getText().trim()); |
| | | sb.append("objectClass: ").append(ServerConstants.OC_GROUP_OF_URLS) |
| | | .append("\n"); |
| | | sb.append(ServerConstants.ATTR_MEMBER_URL).append(": ") |
| | | .append(filter.getText().trim()); |
| | | } |
| | | else |
| | | { |
| | | sb.append("objectClass: ds-virtual-static-group\n"); |
| | | sb.append("objectClass: "+ServerConstants.OC_GROUP_OF_UNIQUE_NAMES+"\n"); |
| | | sb.append("ds-target-group-dn: "+referenceGroup.getText().trim()); |
| | | sb.append("objectClass: ").append(ServerConstants.OC_GROUP_OF_NAMES) |
| | | .append("\n"); |
| | | sb.append("ds-target-group-dn: ").append(referenceGroup.getText().trim()); |
| | | } |
| | | |
| | | return sb.toString(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | INFO_CTRL_PANEL_POSTALADDRESS_FRIENDLY_NAME.get()); |
| | | hmFriendlyAttrNames.put(ServerConstants.ATTR_UNIQUE_MEMBER_LC, |
| | | INFO_CTRL_PANEL_UNIQUEMEMBER_FRIENDLY_NAME.get()); |
| | | hmFriendlyAttrNames.put(ServerConstants.ATTR_MEMBER, |
| | | INFO_CTRL_PANEL_MEMBER_FRIENDLY_NAME.get()); |
| | | hmFriendlyAttrNames.put(ServerConstants.ATTR_MEMBER_URL_LC, |
| | | INFO_CTRL_PANEL_MEMBERURL_FRIENDLY_NAME.get()); |
| | | hmFriendlyAttrNames.put(ServerConstants.ATTR_C, |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * Tells whether a given entry exists and contains the specified object class. |
| | | * Tells whether a given entry exists and contains one of the specified object |
| | | * classes. |
| | | * @param dn the DN of the entry. |
| | | * @param objectClass the object class. |
| | | * @return <CODE>true</CODE> if the entry exists and contains the specified |
| | | * object class and <CODE>false</CODE> otherwise. |
| | | * @param objectClasses the object classes to check. |
| | | * @return <CODE>true</CODE> if the entry exists and contains one of the |
| | | * specified object classes and <CODE>false</CODE> otherwise. |
| | | */ |
| | | protected boolean hasObjectClass(String dn, String objectClass) |
| | | protected boolean hasObjectClass(String dn, String... objectClasses) |
| | | { |
| | | boolean hasObjectClass = false; |
| | | try |
| | | { |
| | | SearchControls ctls = new SearchControls(); |
| | |
| | | { |
| | | for (String s : values) |
| | | { |
| | | for (String objectClass: objectClasses) |
| | | { |
| | | if (s.equalsIgnoreCase(objectClass)) |
| | | { |
| | | hasObjectClass = true; |
| | | break; |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | return hasObjectClass; |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | INFO_CTRL_PANEL_FACSIMILETELEPHONENUMBER_FRIENDLY_NAME=Fax Number |
| | | INFO_CTRL_PANEL_DESCRIPTION_FRIENDLY_NAME=Description |
| | | INFO_CTRL_PANEL_POSTALADDRESS_FRIENDLY_NAME=Address |
| | | INFO_CTRL_PANEL_MEMBER_FRIENDLY_NAME=Members of Group |
| | | INFO_CTRL_PANEL_UNIQUEMEMBER_FRIENDLY_NAME=Members of Group |
| | | INFO_CTRL_PANEL_MEMBERURL_FRIENDLY_NAME=LDAP URL |
| | | INFO_CTRL_PANEL_C_FRIENDLY_NAME=Country |
| | |
| | | # CDDL HEADER END |
| | | # |
| | | # Copyright 2006-2010 Sun Microsystems, Inc. |
| | | # Portions Copyright 2011-2012 ForgeRock AS |
| | | # Portions Copyright 2011-2013 ForgeRock AS |
| | | |
| | | |
| | | |
| | |
| | | INFO_CTRL_PANEL_FACSIMILETELEPHONENUMBER_FRIENDLY_NAME=Faxnummer |
| | | INFO_CTRL_PANEL_DESCRIPTION_FRIENDLY_NAME=Beschreibung |
| | | INFO_CTRL_PANEL_POSTALADDRESS_FRIENDLY_NAME=Adresse |
| | | INFO_CTRL_PANEL_MEMBER_FRIENDLY_NAME=Mitglieder der Gruppe |
| | | INFO_CTRL_PANEL_UNIQUEMEMBER_FRIENDLY_NAME=Mitglieder der Gruppe |
| | | INFO_CTRL_PANEL_MEMBERURL_FRIENDLY_NAME=LDAP-URL |
| | | INFO_CTRL_PANEL_C_FRIENDLY_NAME=Land |
| | |
| | | # CDDL HEADER END |
| | | # |
| | | # Copyright 2006-2010 Sun Microsystems, Inc. |
| | | # Portions Copyright 2011-2012 ForgeRock AS |
| | | # Portions Copyright 2011-2013 ForgeRock AS |
| | | |
| | | |
| | | |
| | |
| | | INFO_CTRL_PANEL_DESCRIPTION_FRIENDLY_NAME=Descripci\u00f3n |
| | | INFO_CTRL_PANEL_POSTALADDRESS_FRIENDLY_NAME=Direcci\u00f3n |
| | | INFO_CTRL_PANEL_UNIQUEMEMBER_FRIENDLY_NAME=Miembros del grupo |
| | | INFO_CTRL_PANEL_MEMBER_FRIENDLY_NAME=Miembros del grupo |
| | | INFO_CTRL_PANEL_MEMBERURL_FRIENDLY_NAME=URL LDAP |
| | | INFO_CTRL_PANEL_C_FRIENDLY_NAME=Pa\u00eds |
| | | INFO_CTRL_PANEL_DS_TARGET_GROUP_DN_FRIENDLY_NAME=ND de referencia de grupo din\u00e1mico |
| | |
| | | # CDDL HEADER END |
| | | # |
| | | # Copyright 2006-2010 Sun Microsystems, Inc. |
| | | # Portions Copyright 2011-2012 ForgeRock AS |
| | | # Portions Copyright 2011-2013 ForgeRock AS |
| | | |
| | | |
| | | |
| | |
| | | INFO_CTRL_PANEL_DESCRIPTION_FRIENDLY_NAME=Description |
| | | INFO_CTRL_PANEL_POSTALADDRESS_FRIENDLY_NAME=Adresse |
| | | INFO_CTRL_PANEL_UNIQUEMEMBER_FRIENDLY_NAME=Membres du groupe |
| | | INFO_CTRL_PANEL_MEMBER_FRIENDLY_NAME=Membres du groupe |
| | | INFO_CTRL_PANEL_MEMBERURL_FRIENDLY_NAME=Url de LDAP |
| | | INFO_CTRL_PANEL_C_FRIENDLY_NAME=Pays |
| | | INFO_CTRL_PANEL_DS_TARGET_GROUP_DN_FRIENDLY_NAME=DN de r\u00e9f\u00e9rence de groupe dynamique |
| | |
| | | # CDDL HEADER END |
| | | # |
| | | # Copyright 2006-2010 Sun Microsystems, Inc. |
| | | # Portions Copyright 2011-2012 ForgeRock AS |
| | | # Portions Copyright 2011-2013 ForgeRock AS |
| | | |
| | | |
| | | |
| | |
| | | INFO_CTRL_PANEL_DESCRIPTION_FRIENDLY_NAME=\u8aac\u660e |
| | | INFO_CTRL_PANEL_POSTALADDRESS_FRIENDLY_NAME=\u4f4f\u6240 |
| | | INFO_CTRL_PANEL_UNIQUEMEMBER_FRIENDLY_NAME=\u30b0\u30eb\u30fc\u30d7\u306e\u30e1\u30f3\u30d0\u30fc |
| | | INFO_CTRL_PANEL_MEMBER_FRIENDLY_NAME=\u30b0\u30eb\u30fc\u30d7\u306e\u30e1\u30f3\u30d0\u30fc |
| | | INFO_CTRL_PANEL_MEMBERURL_FRIENDLY_NAME=LDAP URL |
| | | INFO_CTRL_PANEL_C_FRIENDLY_NAME=\u56fd\u540d |
| | | INFO_CTRL_PANEL_DS_TARGET_GROUP_DN_FRIENDLY_NAME=\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u30b0\u30eb\u30fc\u30d7\u53c2\u7167 DN |
| | |
| | | # CDDL HEADER END |
| | | # |
| | | # Copyright 2006-2010 Sun Microsystems, Inc. |
| | | # Portions Copyright 2011-2012 ForgeRock AS |
| | | # Portions Copyright 2011-2013 ForgeRock AS |
| | | |
| | | |
| | | |
| | |
| | | INFO_CTRL_PANEL_DESCRIPTION_FRIENDLY_NAME=\u63cf\u8ff0 |
| | | INFO_CTRL_PANEL_POSTALADDRESS_FRIENDLY_NAME=\u5730\u5740 |
| | | INFO_CTRL_PANEL_UNIQUEMEMBER_FRIENDLY_NAME=\u7ec4\u6210\u5458 |
| | | INFO_CTRL_PANEL_MEMBER_FRIENDLY_NAME=\u7ec4\u6210\u5458 |
| | | INFO_CTRL_PANEL_MEMBERURL_FRIENDLY_NAME=LDAP URL |
| | | INFO_CTRL_PANEL_C_FRIENDLY_NAME=\u56fd\u5bb6/\u5730\u533a |
| | | INFO_CTRL_PANEL_DS_TARGET_GROUP_DN_FRIENDLY_NAME=\u52a8\u6001\u7ec4\u5f15\u7528 DN |