James Moger
2013-09-30 699e71e76b15081baf746c6ce9c9144f7e5f1ff9
src/main/java/com/gitblit/client/EditUserDialog.java
@@ -79,29 +79,29 @@
   private JPasswordField passwordField;
   private JPasswordField confirmPasswordField;
   private JTextField displayNameField;
   private JTextField emailAddressField;
   private JCheckBox canAdminCheckbox;
   private JCheckBox canForkCheckbox;
   private JCheckBox canCreateCheckbox;
   private JCheckBox notFederatedCheckbox;
   private JTextField organizationalUnitField;
   private JTextField organizationField;
   private JTextField localityField;
   private JTextField stateProvinceField;
   private JTextField countryCodeField;
   private RegistrantPermissionsPanel repositoryPalette;
   private JPalette<TeamModel> teamsPalette;
@@ -132,6 +132,7 @@
      KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
      JRootPane rootPane = new JRootPane();
      rootPane.registerKeyboardAction(new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
         }
@@ -146,19 +147,19 @@
            25);
      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);
      canAdminCheckbox = new JCheckBox(Translation.get("gb.canAdminDescription"), anUser.canAdmin);
      canForkCheckbox = new JCheckBox(Translation.get("gb.canForkDescription"), anUser.canFork);
      canCreateCheckbox = new JCheckBox(Translation.get("gb.canCreateDescription"), anUser.canCreate);
      notFederatedCheckbox = new JCheckBox(
            Translation.get("gb.excludeFromFederationDescription"),
            anUser.excludeFromFederation);
      organizationalUnitField = new JTextField(anUser.organizationalUnit == null ? "" : anUser.organizationalUnit, 25);
      organizationField = new JTextField(anUser.organization == null ? "" : anUser.organization, 25);
      localityField = new JTextField(anUser.locality == null ? "" : anUser.locality, 25);
      stateProvinceField = new JTextField(anUser.stateProvince == null ? "" : anUser.stateProvince, 25);
      countryCodeField = new JTextField(anUser.countryCode == null ? "" : anUser.countryCode, 15);
      // credentials are optionally controlled by 3rd-party authentication
      usernameField.setEnabled(settings.supportsCredentialChanges);
      passwordField.setEnabled(settings.supportsCredentialChanges);
@@ -166,7 +167,7 @@
      displayNameField.setEnabled(settings.supportsDisplayNameChanges);
      emailAddressField.setEnabled(settings.supportsEmailAddressChanges);
      organizationalUnitField.setEnabled(settings.supportsDisplayNameChanges);
      organizationField.setEnabled(settings.supportsDisplayNameChanges);
      localityField.setEnabled(settings.supportsDisplayNameChanges);
@@ -191,7 +192,7 @@
      attributesPanel.add(newFieldPanel(Translation.get("gb.locality") + " (L)", localityField));
      attributesPanel.add(newFieldPanel(Translation.get("gb.stateProvince") + " (ST)", stateProvinceField));
      attributesPanel.add(newFieldPanel(Translation.get("gb.countryCode") + " (C)", countryCodeField));
      final Insets _insets = new Insets(5, 5, 5, 5);
      repositoryPalette = new RegistrantPermissionsPanel(RegistrantType.REPOSITORY);
      teamsPalette = new JPalette<TeamModel>();
@@ -207,6 +208,7 @@
         private static final long serialVersionUID = 1L;
         @Override
         public Insets getInsets() {
            return _insets;
         }
@@ -217,6 +219,7 @@
         private static final long serialVersionUID = 1L;
         @Override
         public Insets getInsets() {
            return _insets;
         }
@@ -233,6 +236,7 @@
      JButton createButton = new JButton(Translation.get("gb.save"));
      createButton.addActionListener(new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent event) {
            if (validateFields()) {
               canceled = false;
@@ -243,6 +247,7 @@
      JButton cancelButton = new JButton(Translation.get("gb.cancel"));
      cancelButton.addActionListener(new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent event) {
            canceled = true;
            setVisible(false);
@@ -349,7 +354,7 @@
         // no change in password
         user.password = password;
      }
      user.displayName = displayNameField.getText().trim();
      user.emailAddress = emailAddressField.getText().trim();
@@ -363,7 +368,7 @@
      user.locality = localityField.getText().trim();
      user.stateProvince = stateProvinceField.getText().trim();
      user.countryCode = countryCodeField.getText().trim();
      for (RegistrantAccessPermission rp : repositoryPalette.getPermissions()) {
         user.setRepositoryPermission(rp.registrant, rp.permission);
      }
@@ -394,16 +399,16 @@
            if (repo.accessRestriction.exceeds(AccessRestrictionType.NONE)
                  && repo.authorizationControl.equals(AuthorizationControl.NAMED)) {
               restricted.add(repo.name);
            }
            }
         }
         repoMap.put(repo.name.toLowerCase(), repo);
      }
      StringUtils.sortRepositorynames(restricted);
      List<String> list = new ArrayList<String>();
      // repositories
      list.add(".*");
      String prefix;
      if (settings.hasKey(Keys.git.userRepositoryPrefix)) {
         prefix = settings.get(Keys.git.userRepositoryPrefix).currentValue;
@@ -418,7 +423,7 @@
         // all repositories excluding personal repositories
         list.add("[^" + prefix + "].*");
      }
      String lastProject = null;
      for (String repo : restricted) {
         String projectPath = StringUtils.getFirstPathElement(repo).toLowerCase();
@@ -440,7 +445,7 @@
            list.remove(rp.registrant.toLowerCase());
         }
      }
      // update owner and missing permissions for editing
      for (RegistrantAccessPermission permission : permissions) {
         if (permission.mutable && PermissionType.EXPLICIT.equals(permission.permissionType)) {
@@ -471,7 +476,7 @@
      }
      teamsPalette.setObjects(teams, selected);
   }
   public UserModel getUser() {
      if (canceled) {
         return null;