From d5603a7722adc4bb9ddeeac31491ba93d8bb9128 Mon Sep 17 00:00:00 2001 From: James Moger Date: Fri, 14 Mar 2014 12:11:20 -0400 Subject: [PATCH] Fix incorrect displayed SSH transport permission --- src/main/java/com/gitblit/GitBlit.java | 2 +- .../com/gitblit/manager/ServicesManager.java | 22 ++----------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/gitblit/GitBlit.java b/src/main/java/com/gitblit/GitBlit.java index a15bed89..817d18cb 100644 --- a/src/main/java/com/gitblit/GitBlit.java +++ b/src/main/java/com/gitblit/GitBlit.java @@ -133,7 +133,7 @@ public class GitBlit extends GitblitManager { // ssh daemon url String sshDaemonUrl = servicesManager.getSshDaemonUrl(request, user, repository); if (!StringUtils.isEmpty(sshDaemonUrl)) { - AccessPermission permission = servicesManager.getSshDaemonAccessPermission(user, repository); + AccessPermission permission = user.getRepositoryPermission(repository).permission; if (permission.exceeds(AccessPermission.NONE)) { list.add(new RepositoryUrl(sshDaemonUrl, permission)); } diff --git a/src/main/java/com/gitblit/manager/ServicesManager.java b/src/main/java/com/gitblit/manager/ServicesManager.java index 1f494055..17724f2b 100644 --- a/src/main/java/com/gitblit/manager/ServicesManager.java +++ b/src/main/java/com/gitblit/manager/ServicesManager.java @@ -244,29 +244,11 @@ public class ServicesManager implements IManager { return null; } - public AccessPermission getSshDaemonAccessPermission(UserModel user, RepositoryModel repository) { - if (sshDaemon != null && user.canClone(repository)) { - AccessPermission sshDaemonPermission = user.getRepositoryPermission(repository).permission; - if (sshDaemonPermission.atLeast(AccessPermission.CLONE)) { - if (repository.accessRestriction.atLeast(AccessRestrictionType.CLONE)) { - // can not authenticate clone via anonymous ssh protocol - sshDaemonPermission = AccessPermission.NONE; - } else if (repository.accessRestriction.atLeast(AccessRestrictionType.PUSH)) { - // can not authenticate push via anonymous ssh protocol - sshDaemonPermission = AccessPermission.CLONE; - } else { - // normal user permission - } - } - return sshDaemonPermission; - } - return AccessPermission.NONE; - } - + /** * Extract the hostname from the canonical url or return the * hostname from the servlet request. - * + * * @param request * @return */ -- 2.39.5