From 11eb4b51accebf8a163e8f46f99b067eda80f7b9 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 23 May 2014 08:29:14 -0400
Subject: [PATCH] Remove GitBlit static singleton reference from localclone.groovy

---
 src/main/java/com/gitblit/Constants.java |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/gitblit/Constants.java b/src/main/java/com/gitblit/Constants.java
index 889e5a3..e4d92e1 100644
--- a/src/main/java/com/gitblit/Constants.java
+++ b/src/main/java/com/gitblit/Constants.java
@@ -423,6 +423,8 @@
 
 		public static final AccessPermission [] NEWPERMISSIONS = { EXCLUDE, VIEW, CLONE, PUSH, CREATE, DELETE, REWIND };
 
+		public static final AccessPermission [] SSHPERMISSIONS = { VIEW, CLONE, PUSH };
+
 		public static AccessPermission LEGACY = REWIND;
 
 		public final String code;
@@ -501,7 +503,7 @@
 	}
 
 	public static enum AuthenticationType {
-		SSH, CREDENTIALS, COOKIE, CERTIFICATE, CONTAINER;
+		PUBLIC_KEY, CREDENTIALS, COOKIE, CERTIFICATE, CONTAINER;
 
 		public boolean isStandard() {
 			return ordinal() <= COOKIE.ordinal();
@@ -538,6 +540,30 @@
 		}
 	}
 
+	public static enum Transport {
+		// ordered for url advertisements, assuming equal access permissions
+		SSH, HTTPS, HTTP, GIT;
+
+		public static Transport fromString(String value) {
+			for (Transport t : values()) {
+				if (t.name().equalsIgnoreCase(value)) {
+					return t;
+				}
+			}
+			return null;
+		}
+
+		public static Transport fromUrl(String url) {
+			int delim = url.indexOf("://");
+			if (delim == -1) {
+				// if no protocol is specified, SSH is assumed by git clients
+				return SSH;
+			}
+			String scheme = url.substring(0, delim);
+			return fromString(scheme);
+		}
+	}
+
 	@Documented
 	@Retention(RetentionPolicy.RUNTIME)
 	public @interface Unused {

--
Gitblit v1.9.1