From 077d23176a8f098766bf492081ae5ab9acb2d285 Mon Sep 17 00:00:00 2001 From: Carsten Lenz <clenz2@csc.com> Date: Fri, 13 Jun 2014 08:26:23 -0400 Subject: [PATCH] Add german translation of welcome.mkd --- src/main/java/com/gitblit/manager/ServicesManager.java | 55 ++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 34 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/gitblit/manager/ServicesManager.java b/src/main/java/com/gitblit/manager/ServicesManager.java index 1f49405..3721578 100644 --- a/src/main/java/com/gitblit/manager/ServicesManager.java +++ b/src/main/java/com/gitblit/manager/ServicesManager.java @@ -47,6 +47,7 @@ import com.gitblit.utils.IdGenerator; import com.gitblit.utils.StringUtils; import com.gitblit.utils.TimeUtils; +import com.gitblit.utils.WorkQueue; /** * Services manager manages long-running services/processes that either have no @@ -66,6 +67,10 @@ private final IGitblit gitblit; + private final IdGenerator idGenerator; + + private final WorkQueue workQueue; + private FanoutService fanoutService; private GitDaemon gitDaemon; @@ -75,6 +80,9 @@ public ServicesManager(IGitblit gitblit) { this.settings = gitblit.getSettings(); this.gitblit = gitblit; + int defaultThreadPoolSize = settings.getInteger(Keys.execution.defaultThreadPoolSize, 1); + this.idGenerator = new IdGenerator(); + this.workQueue = new WorkQueue(idGenerator, defaultThreadPoolSize); } @Override @@ -99,7 +107,26 @@ if (sshDaemon != null) { sshDaemon.stop(); } + workQueue.stop(); return this; + } + + public boolean isServingRepositories() { + return isServingHTTP() + || isServingGIT() + || isServingSSH(); + } + + public boolean isServingHTTP() { + return settings.getBoolean(Keys.git.enableGitServlet, true); + } + + public boolean isServingGIT() { + return gitDaemon != null && gitDaemon.isRunning(); + } + + public boolean isServingSSH() { + return sshDaemon != null && sshDaemon.isRunning(); } protected void configureFederation() { @@ -152,7 +179,7 @@ String bindInterface = settings.getString(Keys.git.sshBindInterface, "localhost"); if (port > 0) { try { - sshDaemon = new SshDaemon(gitblit, new IdGenerator()); + sshDaemon = new SshDaemon(gitblit, workQueue); sshDaemon.start(); } catch (IOException e) { sshDaemon = null; @@ -228,6 +255,10 @@ } public String getSshDaemonUrl(HttpServletRequest request, UserModel user, RepositoryModel repository) { + if (user == null || UserModel.ANONYMOUS.equals(user)) { + // SSH always requires authentication - anonymous access prohibited + return null; + } if (sshDaemon != null) { String bindInterface = settings.getString(Keys.git.sshBindInterface, "localhost"); if (bindInterface.equals("localhost") @@ -244,29 +275,11 @@ 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 */ -- Gitblit v1.9.1