From 3980c1e48e604fd743f4622771602941b7ede9d4 Mon Sep 17 00:00:00 2001 From: James Moger Date: Wed, 25 Apr 2012 17:39:18 -0400 Subject: [PATCH] Allow manipulating display name and email address from manager app --- src/com/gitblit/client/EditUserDialog.java | 13 ++++++++++++- src/com/gitblit/client/UsersTableModel.java | 6 +++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/com/gitblit/client/EditUserDialog.java b/src/com/gitblit/client/EditUserDialog.java index f3665d9b..d78924c4 100644 --- a/src/com/gitblit/client/EditUserDialog.java +++ b/src/com/gitblit/client/EditUserDialog.java @@ -72,6 +72,10 @@ public class EditUserDialog extends JDialog { private JPasswordField passwordField; private JPasswordField confirmPasswordField; + + private JTextField displayNameField; + + private JTextField emailAddressField; private JCheckBox canAdminCheckbox; @@ -119,7 +123,9 @@ public class EditUserDialog extends JDialog { passwordField = new JPasswordField(anUser.password == null ? "" : anUser.password, 25); confirmPasswordField = new JPasswordField(anUser.password == null ? "" : anUser.password, 25); - canAdminCheckbox = new JCheckBox(Translation.get("gb.canAdminDescription"), anUser.canAdmin); + displayNameField = new JTextField(anUser.displayName == null ? "" : anUser.displayName, 25); + emailAddressField = new JTextField(anUser.emailAddress == null ? "" : anUser.emailAddress, 25); + canAdminCheckbox = new JCheckBox(Translation.get("gb.canAdminDescription"), anUser.canAdmin); notFederatedCheckbox = new JCheckBox( Translation.get("gb.excludeFromFederationDescription"), anUser.excludeFromFederation); @@ -128,6 +134,8 @@ public class EditUserDialog extends JDialog { fieldsPanel.add(newFieldPanel(Translation.get("gb.username"), usernameField)); fieldsPanel.add(newFieldPanel(Translation.get("gb.password"), passwordField)); fieldsPanel.add(newFieldPanel(Translation.get("gb.confirmPassword"), confirmPasswordField)); + fieldsPanel.add(newFieldPanel(Translation.get("gb.displayName"), displayNameField)); + fieldsPanel.add(newFieldPanel(Translation.get("gb.emailAddress"), emailAddressField)); fieldsPanel.add(newFieldPanel(Translation.get("gb.canAdmin"), canAdminCheckbox)); fieldsPanel.add(newFieldPanel(Translation.get("gb.excludeFromFederation"), notFederatedCheckbox)); @@ -284,6 +292,9 @@ public class EditUserDialog extends JDialog { // no change in password user.password = password; } + + user.displayName = displayNameField.getText().trim(); + user.emailAddress = emailAddressField.getText().trim(); user.canAdmin = canAdminCheckbox.isSelected(); user.excludeFromFederation = notFederatedCheckbox.isSelected(); diff --git a/src/com/gitblit/client/UsersTableModel.java b/src/com/gitblit/client/UsersTableModel.java index fa86a13e..c05230ea 100644 --- a/src/com/gitblit/client/UsersTableModel.java +++ b/src/com/gitblit/client/UsersTableModel.java @@ -36,7 +36,7 @@ public class UsersTableModel extends AbstractTableModel { List list; enum Columns { - Name, AccessLevel, Teams, Repositories; + Name, Display_Name, AccessLevel, Teams, Repositories; @Override public String toString() { @@ -69,6 +69,8 @@ public class UsersTableModel extends AbstractTableModel { switch (col) { case Name: return Translation.get("gb.name"); + case Display_Name: + return Translation.get("gb.displayName"); case AccessLevel: return Translation.get("gb.accessLevel"); case Teams: @@ -97,6 +99,8 @@ public class UsersTableModel extends AbstractTableModel { switch (col) { case Name: return model.username; + case Display_Name: + return model.displayName; case AccessLevel: if (model.canAdmin) { return "administrator"; -- 2.39.5