- added: Gitblit Manager (Java/Swing Application) for remote administration of a Gitblit server.\r
- fixed: federation protocol timestamps. dates are now serialized to the [iso8601](http://en.wikipedia.org/wiki/ISO_8601) standard. \r
**This breaks 0.6.0 federation clients/servers.**\r
+- fixed: collision on rename for repositories and users\r
- fixed: Gitblit can now browse the Linux kernel repository (issue 25)\r
- fixed: Gitblit now runs on Servlet 3.0 webservers (e.g. Tomcat 7, Jetty 8) (issue 23)\r
- fixed: Set the RSS content type for Firefox 4 (issue 22)\r
- added: Gitblit Manager (Java/Swing Application) for remote administration of a Gitblit server.\r
- fixed: federation protocol timestamps. dates are now serialized to the [iso8601](http://en.wikipedia.org/wiki/ISO_8601) standard. \r
**This breaks 0.6.0 federation clients/servers.**\r
+- fixed: collision on rename for repositories and users\r
- fixed: Gitblit can now browse the Linux kernel repository (issue 25)\r
- fixed: Gitblit now runs on Servlet 3.0 webservers (e.g. Tomcat 7, Jetty 8) (issue 23)\r
- fixed: Set the RSS content type for Firefox 4 (issue 22)\r
*/\r
public void updateUserModel(String username, UserModel user, boolean isCreate)\r
throws GitBlitException {\r
+ if (!username.equalsIgnoreCase(user.username)) {\r
+ if (userService.getUserModel(user.username) != null) {\r
+ throw new GitBlitException(\r
+ MessageFormat\r
+ .format("Failed to rename ''{0}'' because ''{1}'' already exists.",\r
+ username, user.username));\r
+ }\r
+ }\r
if (!userService.updateUserModel(username, user)) {\r
throw new GitBlitException(isCreate ? "Failed to add user!" : "Failed to update user!");\r
}\r
} else {\r
// rename repository\r
if (!repositoryName.equalsIgnoreCase(repository.name)) {\r
+ if (!repository.name.toLowerCase().endsWith(\r
+ org.eclipse.jgit.lib.Constants.DOT_GIT_EXT)) {\r
+ repository.name += org.eclipse.jgit.lib.Constants.DOT_GIT_EXT;\r
+ }\r
+ if (new File(repositoriesFolder, repository.name).exists()) {\r
+ throw new GitBlitException(\r
+ MessageFormat\r
+ .format("Failed to rename ''{0}'' because ''{1}'' already exists.",\r
+ repositoryName, repository.name));\r
+ }\r
closeRepository(repositoryName);\r
File folder = new File(repositoriesFolder, repositoryName);\r
File destFolder = new File(repositoriesFolder, repository.name);\r
\r
private static final long serialVersionUID = 1L;\r
\r
+ private final String repositoryName;\r
+\r
private final RepositoryModel repository;\r
\r
private boolean isCreate;\r
\r
public EditRepositoryDialog(RepositoryModel aRepository) {\r
super();\r
+ this.repositoryName = aRepository.name;\r
this.repository = new RepositoryModel();\r
this.repositoryNames = new HashSet<String>();\r
this.isCreate = false;\r
setTitle(Translation.get("gb.edit") + ": " + aRepository.name);\r
setIconImage(new ImageIcon(getClass().getResource("/gitblt-favicon.png")).getImage());\r
}\r
- \r
+\r
@Override\r
protected JRootPane createRootPane() {\r
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);\r
fieldsPanel\r
.add(newFieldPanel(Translation.get("gb.showRemoteBranches"), showRemoteBranches));\r
fieldsPanel.add(newFieldPanel(Translation.get("gb.showReadme"), showReadme));\r
- fieldsPanel.add(newFieldPanel(Translation.get("gb.skipSizeCalculation"), skipSizeCalculation));\r
+ fieldsPanel.add(newFieldPanel(Translation.get("gb.skipSizeCalculation"),\r
+ skipSizeCalculation));\r
fieldsPanel.add(newFieldPanel(Translation.get("gb.isFrozen"), isFrozen));\r
\r
usersPalette = new JPalette<String>();\r
"Can not create repository ''{0}'' because it already exists.", rname));\r
return false;\r
}\r
+ } else {\r
+ // check rename collision\r
+ if (!repositoryName.equalsIgnoreCase(rname)) {\r
+ if (repositoryNames.contains(rname.toLowerCase())) {\r
+ error(MessageFormat.format(\r
+ "Failed to rename ''{0}'' because ''{1}'' already exists.",\r
+ repositoryName, rname));\r
+ return false;\r
+ }\r
+ }\r
}\r
\r
if (accessRestriction.getSelectedItem() == null) {\r
\r
private static final long serialVersionUID = 1L;\r
\r
+ private final String username;\r
+\r
private final UserModel user;\r
\r
private final ServerSettings settings;\r
\r
public EditUserDialog(UserModel anUser, ServerSettings settings) {\r
super();\r
+ this.username = anUser.username;\r
this.user = new UserModel("");\r
this.settings = settings;\r
this.usernames = new HashSet<String>();\r
error(MessageFormat.format("Username ''{0}'' is unavailable.", uname));\r
return false;\r
}\r
+ } else {\r
+ // check rename collision\r
+ if (!username.equalsIgnoreCase(uname)) {\r
+ if (usernames.contains(uname.toLowerCase())) {\r
+ error(MessageFormat.format(\r
+ "Failed to rename ''{0}'' because ''{1}'' already exists.", username,\r
+ uname));\r
+ return false;\r
+ }\r
+ }\r
}\r
\r
int minLength = settings.get(Keys.realm.minPasswordLength).getInteger(5);\r
List<String> usernames = gitblit.getUsernames();\r
List<String> members = gitblit.getPermittedUsernames(repository);\r
dialog.setUsers(repository.owner, usernames, members);\r
+ dialog.setRepositories(gitblit.getRepositories());\r
dialog.setFederationSets(gitblit.getFederationSets(), repository.federationSets);\r
dialog.setVisible(true);\r
final RepositoryModel revisedRepository = dialog.getRepository();\r
protected void editUser(final UserModel user) {\r
EditUserDialog dialog = new EditUserDialog(user, gitblit.getSettings());\r
dialog.setLocationRelativeTo(GitblitPanel.this);\r
+ dialog.setUsers(gitblit.getUsers());\r
dialog.setRepositories(gitblit.getRepositories(), new ArrayList<String>(user.repositories));\r
dialog.setVisible(true);\r
final UserModel revisedUser = dialog.getUser();\r