From 2711bc82a373a3c2e357b5948e2a6e0c477d8534 Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 22 Oct 2012 16:23:53 -0400 Subject: [PATCH] Fixed bug where owner could not edit a repository through web ui --- src/com/gitblit/wicket/pages/EditRepositoryPage.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/com/gitblit/wicket/pages/EditRepositoryPage.java b/src/com/gitblit/wicket/pages/EditRepositoryPage.java index 200a50e0..98b04f50 100644 --- a/src/com/gitblit/wicket/pages/EditRepositoryPage.java +++ b/src/com/gitblit/wicket/pages/EditRepositoryPage.java @@ -122,7 +122,8 @@ public class EditRepositoryPage extends RootSubPage { GitBlitWebSession session = GitBlitWebSession.get(); final UserModel user = session.getUser() == null ? UserModel.ANONYMOUS : session.getUser(); - + final boolean allowEditName = isCreate || isAdmin || repositoryModel.isUsersPersonalRepository(user.username); + if (isCreate) { if (user.canAdmin()) { super.setupPage(getString("gb.newRepository"), ""); @@ -253,7 +254,7 @@ public class EditRepositoryPage extends RootSubPage { return; } - if (user.canCreate() && !user.canAdmin()) { + if (user.canCreate() && !user.canAdmin() && allowEditName) { // ensure repository name begins with the user's path if (!repositoryModel.name.startsWith(user.getPersonalPath())) { error(MessageFormat.format(getString("gb.illegalPersonalRepositoryLocation"), @@ -360,7 +361,7 @@ public class EditRepositoryPage extends RootSubPage { form.add(new SimpleAttributeModifier("autocomplete", "off")); // field names reflective match RepositoryModel fields - form.add(new TextField("name").setEnabled(isCreate || isAdmin || repositoryModel.isUsersPersonalRepository(user.username))); + form.add(new TextField("name").setEnabled(allowEditName)); form.add(new TextField("description")); form.add(new DropDownChoice("owner", GitBlit.self().getAllUsernames()) .setEnabled(GitBlitWebSession.get().canAdmin())); -- 2.39.5