]> source.dussan.org Git - gitblit.git/commitdiff
Fixed bug where owner could not edit a repository through web ui
authorJames Moger <james.moger@gitblit.com>
Mon, 22 Oct 2012 20:23:53 +0000 (16:23 -0400)
committerJames Moger <james.moger@gitblit.com>
Mon, 22 Oct 2012 20:23:53 +0000 (16:23 -0400)
src/com/gitblit/wicket/pages/EditRepositoryPage.java

index 200a50e07c14b8d69a27e90c4e6cf0c907b6cd50..98b04f50171bb4b74d7e19ffaba18a9e02a489ac 100644 (file)
@@ -122,7 +122,8 @@ public class EditRepositoryPage extends RootSubPage {
 \r
                GitBlitWebSession session = GitBlitWebSession.get();\r
                final UserModel user = session.getUser() == null ? UserModel.ANONYMOUS : session.getUser();\r
-\r
+               final boolean allowEditName = isCreate || isAdmin || repositoryModel.isUsersPersonalRepository(user.username);\r
+               \r
                if (isCreate) {\r
                        if (user.canAdmin()) {\r
                                super.setupPage(getString("gb.newRepository"), "");\r
@@ -253,7 +254,7 @@ public class EditRepositoryPage extends RootSubPage {
                                                return;\r
                                        }\r
                                        \r
-                                       if (user.canCreate() && !user.canAdmin()) {\r
+                                       if (user.canCreate() && !user.canAdmin() && allowEditName) {\r
                                                // ensure repository name begins with the user's path\r
                                                if (!repositoryModel.name.startsWith(user.getPersonalPath())) {\r
                                                        error(MessageFormat.format(getString("gb.illegalPersonalRepositoryLocation"),\r
@@ -360,7 +361,7 @@ public class EditRepositoryPage extends RootSubPage {
                form.add(new SimpleAttributeModifier("autocomplete", "off"));\r
 \r
                // field names reflective match RepositoryModel fields\r
-               form.add(new TextField<String>("name").setEnabled(isCreate || isAdmin || repositoryModel.isUsersPersonalRepository(user.username)));\r
+               form.add(new TextField<String>("name").setEnabled(allowEditName));\r
                form.add(new TextField<String>("description"));\r
                form.add(new DropDownChoice<String>("owner", GitBlit.self().getAllUsernames())\r
                                .setEnabled(GitBlitWebSession.get().canAdmin()));\r