]> source.dussan.org Git - gitblit.git/commitdiff
Merged and enhanced pull request #55 (disallow forks setting)
authormschaefers <mschaefers@scoop-gmbh.de>
Tue, 4 Dec 2012 21:07:37 +0000 (16:07 -0500)
committerJames Moger <james.moger@gitblit.com>
Tue, 4 Dec 2012 21:07:37 +0000 (16:07 -0500)
distrib/gitblit.properties
src/com/gitblit/wicket/pages/EditRepositoryPage.java
src/com/gitblit/wicket/pages/EditTeamPage.java
src/com/gitblit/wicket/pages/EditUserPage.java
src/com/gitblit/wicket/pages/RepositoryPage.java

index 233fdfad04f8a2b7ffd5dececf5d65cdf860f281..d57f9ba1a8f15a38e1c54630cd1ae97d27de6485 100644 (file)
@@ -504,6 +504,12 @@ web.compressedDownloads = zip gz
 # SINCE 0.9.0\r
 web.allowLuceneIndexing = true\r
 \r
+# Allows an authenticated user to create forks of a repository\r
+#\r
+# set this to false if you want to disable all fork controls on the web site\r
+#\r
+web.allowForking = true\r
+\r
 # Controls the length of shortened commit hash ids\r
 #\r
 # SINCE 1.2.0\r
@@ -1179,4 +1185,4 @@ server.requireClientCertificates = false
 #\r
 # SINCE 0.5.0\r
 # RESTART REQUIRED\r
-server.shutdownPort = 8081
\ No newline at end of file
+server.shutdownPort = 8081\r
index dead34a91bc64e76eacd02d1297ae7b5521fa110..9de8244a1d675ad46285466ba708d4aac0763eca 100644 (file)
@@ -379,7 +379,7 @@ public class EditRepositoryPage extends RootSubPage {
                form.add(new TextField<String>("description"));\r
                form.add(new DropDownChoice<String>("owner", GitBlit.self().getAllUsernames())\r
                                .setEnabled(GitBlitWebSession.get().canAdmin() && !repositoryModel.isPersonalRepository()));\r
-               form.add(new CheckBox("allowForks"));\r
+               form.add(new CheckBox("allowForks").setEnabled(GitBlit.getBoolean(Keys.web.allowForking, true)));\r
                DropDownChoice<AccessRestrictionType> accessRestriction = new DropDownChoice<AccessRestrictionType>("accessRestriction", Arrays\r
                                .asList(AccessRestrictionType.values()), new AccessRestrictionRenderer());\r
                form.add(accessRestriction);\r
index a22361f1611efb2719b5535b0e57db1d3e0f948d..1991c02a155eb44408bc9075b504d1e8b9fb4a1d 100644 (file)
@@ -38,6 +38,7 @@ import org.apache.wicket.model.util.ListModel;
 \r
 import com.gitblit.GitBlit;\r
 import com.gitblit.GitBlitException;\r
+import com.gitblit.Keys;\r
 import com.gitblit.Constants.RegistrantType;\r
 import com.gitblit.models.RegistrantAccessPermission;\r
 import com.gitblit.models.TeamModel;\r
@@ -216,7 +217,7 @@ public class EditTeamPage extends RootSubPage {
                // field names reflective match TeamModel fields\r
                form.add(new TextField<String>("name"));\r
                form.add(new CheckBox("canAdmin"));\r
-               form.add(new CheckBox("canFork"));\r
+               form.add(new CheckBox("canFork").setEnabled(GitBlit.getBoolean(Keys.web.allowForking, true)));\r
                form.add(new CheckBox("canCreate"));\r
                form.add(users.setEnabled(editMemberships));\r
                mailingLists = new Model<String>(teamModel.mailingLists == null ? ""\r
index 80f09dba1e4aa71d3c1aa17d729569b98ef72c1d..d22800effc678ba82b471b84df26d4040a728adf 100644 (file)
@@ -233,7 +233,7 @@ public class EditUserPage extends RootSubPage {
                form.add(new TextField<String>("displayName").setEnabled(editDisplayName));\r
                form.add(new TextField<String>("emailAddress").setEnabled(editEmailAddress));\r
                form.add(new CheckBox("canAdmin"));\r
-               form.add(new CheckBox("canFork"));\r
+               form.add(new CheckBox("canFork").setEnabled(GitBlit.getBoolean(Keys.web.allowForking, true)));\r
                form.add(new CheckBox("canCreate"));\r
                form.add(new CheckBox("excludeFromFederation"));\r
                form.add(new RegistrantPermissionsPanel("repositories", RegistrantType.REPOSITORY, repos, permissions, getAccessPermissions()));\r
index 346edc3ec8d1183fe1ae61f821fb5855948d911a..3acf73af774b6b67f71c45f9c966b12c784dfccb 100644 (file)
@@ -154,7 +154,9 @@ public abstract class RepositoryPage extends BasePage {
                pages.put("branches", new PageRegistration("gb.branches", BranchesPage.class, params));\r
                pages.put("tags", new PageRegistration("gb.tags", TagsPage.class, params));\r
                pages.put("tree", new PageRegistration("gb.tree", TreePage.class, params));\r
-               pages.put("forks", new PageRegistration("gb.forks", ForksPage.class, params));\r
+               if (GitBlit.getBoolean(Keys.web.allowForking, true)) {\r
+                       pages.put("forks", new PageRegistration("gb.forks", ForksPage.class, params));\r
+               }\r
 \r
                // conditional links\r
                Repository r = getRepository();\r
@@ -191,7 +193,7 @@ public abstract class RepositoryPage extends BasePage {
        }\r
        \r
        protected boolean allowForkControls() {\r
-               return true;\r
+               return GitBlit.getBoolean(Keys.web.allowForking, true);\r
        }\r
 \r
        @Override\r
@@ -597,4 +599,4 @@ public abstract class RepositoryPage extends BasePage {
                        getRequestCycle().setRequestTarget(new RedirectRequestTarget(absoluteUrl));\r
                }\r
        }\r
-}
+}\r