From: James Moger Date: Mon, 22 Oct 2012 20:23:53 +0000 (-0400) Subject: Fixed bug where owner could not edit a repository through web ui X-Git-Tag: v1.2.0~139 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2711bc82a373a3c2e357b5948e2a6e0c477d8534;p=gitblit.git Fixed bug where owner could not edit a repository through web ui --- 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()));