src/com/netscape/admin/dirserv/DSContentPage.java | 13 +++++++++++++
src/com/netscape/admin/dirserv/DSEntryDialog.java | 6 +++++-
2 files changed, 18 insertions(+), 1 deletion(-)
New commits:
commit 2ada9d096cfb80b8d9ca262d67b5e006b2c805a4
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Tue Mar 1 08:13:38 2011 -0800
Bug 229693 - Update naming attribute when objectclass is removed
When an entry is edited in Console using the advanced editor, one
can remove the objectclass that provides the naming attribute. If
the entry happens to be a user or group, the new naming attribute
is not passed to the Console Framework code, causing a non-existant
attribute to be used for the naming attribute. This will cause
operations to fail.
This patch makes the DS Console update the naming attribute properly
when objectclasses are removed.
diff --git a/src/com/netscape/admin/dirserv/DSContentPage.java
b/src/com/netscape/admin/dirserv/DSContentPage.java
index ed1bde0..d00fb55 100644
--- a/src/com/netscape/admin/dirserv/DSContentPage.java
+++ b/src/com/netscape/admin/dirserv/DSContentPage.java
@@ -3590,9 +3590,22 @@ class UserGroupAdapter implements IResEditorAdvancedOpt {
if ( dlg != null ) {
/* Notify the observable from the kingpin editor */
LDAPModificationSet mods = dlg.getChanges();
+ String[] rdnAttrs = dlg.getNamingAttributes();
+
if ((mods != null) && (mods.size() > 0)) {
updateObservable( observableentry, mods );
}
+
+ // The naming attribute may have changed if any
+ // objectclasses were deleted. Update the
+ // observable entry with the new naming attribute.
+ // We don't need to worry about multiple RDN
+ // attributes here since the user has no chance
+ // to select multiple naming attributes when using
+ // the UG adapter.
+ if ((rdnAttrs != null) && (rdnAttrs[0] != null)) {
+ observableentry.setIndexAttribute(rdnAttrs[0]);
+ }
}
return (dlg != null);
}
diff --git a/src/com/netscape/admin/dirserv/DSEntryDialog.java
b/src/com/netscape/admin/dirserv/DSEntryDialog.java
index 052a1d7..bb9864b 100644
--- a/src/com/netscape/admin/dirserv/DSEntryDialog.java
+++ b/src/com/netscape/admin/dirserv/DSEntryDialog.java
@@ -79,7 +79,7 @@ public class DSEntryDialog extends AbstractDialog {
*
* @return Any attributes defined for the entry.
*/
- public LDAPAttributeSet getAttributes() {
+ public LDAPAttributeSet getAttributes() {
return (_entryPanel.getAttributes());
}
@@ -91,6 +91,10 @@ public class DSEntryDialog extends AbstractDialog {
return (_entryPanel.getDN());
}
+ public String[] getNamingAttributes() {
+ return (_entryPanel.getNamingAttributes());
+ }
+
public void packAndShow() {
pack();
/* Using pack the window can be too big (for example for the entry of the schema)*/