]> source.dussan.org Git - gitblit.git/commitdiff
fix permission capping for HTTP/HTTPS 282/head
authorJoel Johnson <mrjoel@lixil.net>
Tue, 30 Jun 2015 07:00:52 +0000 (01:00 -0600)
committerJoel Johnson <mrjoel@lixil.net>
Tue, 30 Jun 2015 07:05:43 +0000 (01:05 -0600)
Previously used request scheme, but request scheme is unrelated to
the URL being generated. Instead, base the permission capping on the
scheme of the URL itself.

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

index 5a957a177a9da4f1b46704f56a1d9d15321d9fd7..c911f31a4ab8f1a5f1aa448dd618708746cba986 100644 (file)
@@ -166,13 +166,14 @@ public class ServicesManager implements IServicesManager {
                        settings.getBoolean(Keys.web.showHttpServletUrls, true)) {
                        AccessPermission permission = user.getRepositoryPermission(repository).permission;
                        if (permission.exceeds(AccessPermission.NONE)) {
-                               Transport transport = Transport.fromString(request.getScheme());
+                               String repoUrl = getRepositoryUrl(request, username, repository);
+                               Transport transport = Transport.fromUrl(repoUrl);
                                if (permission.atLeast(AccessPermission.PUSH) && !acceptsPush(transport)) {
                                        // downgrade the repo permission for this transport
                                        // because it is not an acceptable PUSH transport
                                        permission = AccessPermission.CLONE;
                                }
-                               list.add(new RepositoryUrl(getRepositoryUrl(request, username, repository), permission));
+                               list.add(new RepositoryUrl(repoUrl, permission));
                        }
                }