summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2012-04-25 19:58:46 -0400
committerJames Moger <james.moger@gitblit.com>2012-04-25 19:58:46 -0400
commite191104cd356faa2e261cc37585143878e23298d (patch)
tree4a9be085cd38108d43cf87ca06c50e6153156ac1
parent0aa8cf8606600d628b2c491e52e9e3c901f9cc80 (diff)
downloadgitblit-e191104cd356faa2e261cc37585143878e23298d.tar.gz
gitblit-e191104cd356faa2e261cc37585143878e23298d.zip
Disable membership, display name, and email fields in Manager if unsupported by user service
-rw-r--r--src/com/gitblit/client/EditTeamDialog.java3
-rw-r--r--src/com/gitblit/client/EditUserDialog.java11
-rw-r--r--src/com/gitblit/client/JPalette.java21
-rw-r--r--src/com/gitblit/models/ServerSettings.java8
4 files changed, 37 insertions, 6 deletions
diff --git a/src/com/gitblit/client/EditTeamDialog.java b/src/com/gitblit/client/EditTeamDialog.java
index 80e41608..2f9796ce 100644
--- a/src/com/gitblit/client/EditTeamDialog.java
+++ b/src/com/gitblit/client/EditTeamDialog.java
@@ -125,7 +125,8 @@ public class EditTeamDialog extends JDialog {
final Insets _insets = new Insets(5, 5, 5, 5);
repositoryPalette = new JPalette<String>();
userPalette = new JPalette<String>();
-
+ userPalette.setEnabled(settings.supportsTeamMembershipChanges);
+
JPanel fieldsPanelTop = new JPanel(new BorderLayout());
fieldsPanelTop.add(fieldsPanel, BorderLayout.NORTH);
diff --git a/src/com/gitblit/client/EditUserDialog.java b/src/com/gitblit/client/EditUserDialog.java
index d78924c4..34ab4b5e 100644
--- a/src/com/gitblit/client/EditUserDialog.java
+++ b/src/com/gitblit/client/EditUserDialog.java
@@ -129,6 +129,14 @@ public class EditUserDialog extends JDialog {
notFederatedCheckbox = new JCheckBox(
Translation.get("gb.excludeFromFederationDescription"),
anUser.excludeFromFederation);
+
+ // credentials are optionally controlled by 3rd-party authentication
+ usernameField.setEnabled(settings.supportsCredentialChanges);
+ passwordField.setEnabled(settings.supportsCredentialChanges);
+ confirmPasswordField.setEnabled(settings.supportsCredentialChanges);
+
+ displayNameField.setEnabled(settings.supportsDisplayNameChanges);
+ emailAddressField.setEnabled(settings.supportsEmailAddressChanges);
JPanel fieldsPanel = new JPanel(new GridLayout(0, 1));
fieldsPanel.add(newFieldPanel(Translation.get("gb.username"), usernameField));
@@ -143,6 +151,7 @@ public class EditUserDialog extends JDialog {
final Insets _insets = new Insets(5, 5, 5, 5);
repositoryPalette = new JPalette<String>();
teamsPalette = new JPalette<TeamModel>();
+ teamsPalette.setEnabled(settings.supportsTeamMembershipChanges);
JPanel fieldsPanelTop = new JPanel(new BorderLayout());
fieldsPanelTop.add(fieldsPanel, BorderLayout.NORTH);
@@ -340,7 +349,7 @@ public class EditUserDialog extends JDialog {
}
teamsPalette.setObjects(teams, selected);
}
-
+
public UserModel getUser() {
if (canceled) {
return null;
diff --git a/src/com/gitblit/client/JPalette.java b/src/com/gitblit/client/JPalette.java
index 699b271e..07900cb7 100644
--- a/src/com/gitblit/client/JPalette.java
+++ b/src/com/gitblit/client/JPalette.java
@@ -38,6 +38,10 @@ public class JPalette<T> extends JPanel {
private static final long serialVersionUID = 1L;
private PaletteModel<T> availableModel;
private PaletteModel<T> selectedModel;
+ private JButton add;
+ private JButton subtract;
+ private JButton up;
+ private JButton down;
public JPalette() {
this(false);
@@ -52,7 +56,7 @@ public class JPalette<T> extends JPanel {
final JTable available = new JTable(availableModel);
final JTable selected = new JTable(selectedModel);
- JButton add = new JButton("->");
+ add = new JButton("->");
add.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
List<T> move = new ArrayList<T>();
@@ -70,7 +74,7 @@ public class JPalette<T> extends JPanel {
selectedModel.fireTableDataChanged();
}
});
- JButton subtract = new JButton("<-");
+ subtract = new JButton("<-");
subtract.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
List<T> move = new ArrayList<T>();
@@ -90,7 +94,7 @@ public class JPalette<T> extends JPanel {
}
});
- JButton up = new JButton("\u2191");
+ up = new JButton("\u2191");
up.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
int row = selected.getSelectedRow();
@@ -102,7 +106,7 @@ public class JPalette<T> extends JPanel {
}
});
- JButton down = new JButton("\u2193");
+ down = new JButton("\u2193");
down.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
int row = selected.getSelectedRow();
@@ -149,6 +153,15 @@ public class JPalette<T> extends JPanel {
panel.add(jsp, BorderLayout.CENTER);
return panel;
}
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ add.setEnabled(enabled);
+ subtract.setEnabled(enabled);
+ up.setEnabled(enabled);
+ down.setEnabled(enabled);
+ }
public void setObjects(List<T> all, List<T> selected) {
List<T> available = new ArrayList<T>(all);
diff --git a/src/com/gitblit/models/ServerSettings.java b/src/com/gitblit/models/ServerSettings.java
index 72a7f007..3658096e 100644
--- a/src/com/gitblit/models/ServerSettings.java
+++ b/src/com/gitblit/models/ServerSettings.java
@@ -36,6 +36,14 @@ public class ServerSettings implements Serializable {
private static final long serialVersionUID = 1L;
public List<String> pushScripts;
+
+ public boolean supportsCredentialChanges;
+
+ public boolean supportsDisplayNameChanges;
+
+ public boolean supportsEmailAddressChanges;
+
+ public boolean supportsTeamMembershipChanges;
public ServerSettings() {
settings = new TreeMap<String, SettingModel>();