]> source.dussan.org Git - gitblit.git/commitdiff
New forks shall respect the source repository access restriction 67/167/1
authorJames Moger <james.moger@gitblit.com>
Fri, 5 Sep 2014 23:19:32 +0000 (19:19 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 5 Sep 2014 23:19:32 +0000 (19:19 -0400)
If the source repository access restriction exceeds the fork default (push)
then the fork shall inherit the source repository access restriction.

src/main/java/com/gitblit/manager/GitblitManager.java

index 98ad33e737ac26f48853ed95e54bdae36ba23ab1..b9ae122f1f1f427e5599f1649c052ccf0e4eda97 100644 (file)
@@ -216,6 +216,13 @@ public class GitblitManager implements IGitblit {
                RepositoryModel cloneModel = repository.cloneAs(cloneName);
                // owner has REWIND/RW+ permissions
                cloneModel.addOwner(user.username);
+
+               // ensure initial access restriction of the fork
+               // is not lower than the source repository  (issue-495/ticket-167)
+               if (repository.accessRestriction.exceeds(cloneModel.accessRestriction)) {
+                       cloneModel.accessRestriction = repository.accessRestriction;
+               }
+
                repositoryManager.updateRepositoryModel(cloneName, cloneModel, false);
 
                // add the owner of the source repository to the clone's access list