From: Joel Johnson Date: Tue, 30 Jun 2015 07:00:52 +0000 (-0600) Subject: fix permission capping for HTTP/HTTPS X-Git-Tag: v1.7.0~1^2~48^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F282%2Fhead;p=gitblit.git fix permission capping for HTTP/HTTPS 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. --- diff --git a/src/main/java/com/gitblit/manager/ServicesManager.java b/src/main/java/com/gitblit/manager/ServicesManager.java index 5a957a17..c911f31a 100644 --- a/src/main/java/com/gitblit/manager/ServicesManager.java +++ b/src/main/java/com/gitblit/manager/ServicesManager.java @@ -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)); } }