From d5bdbdf6f0d54d4753f35a9b519fb7da2c2a9da7 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Thu, 25 Jul 2013 18:05:40 -0400
Subject: [PATCH] Fixed Gitblit Authority failing to load realm.NNN.backingUserService (issue-280)

---
 src/main/java/com/gitblit/authority/GitblitAuthority.java |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/gitblit/authority/GitblitAuthority.java b/src/main/java/com/gitblit/authority/GitblitAuthority.java
index e0b079e..bddb1cf 100644
--- a/src/main/java/com/gitblit/authority/GitblitAuthority.java
+++ b/src/main/java/com/gitblit/authority/GitblitAuthority.java
@@ -261,12 +261,9 @@
 		String us = gitblitSettings.getString(Keys.realm.userService, "${baseFolder}/users.conf");
 		String ext = us.substring(us.lastIndexOf(".") + 1).toLowerCase();
 		IUserService service = null;
-		if (!ext.equals("conf") && !ext.equals("properties")) {
-			if (us.equals("com.gitblit.LdapUserService")) {
-				us = gitblitSettings.getString(Keys.realm.ldap.backingUserService, "${baseFolder}/users.conf");		
-			} else if (us.equals("com.gitblit.LdapUserService")) {
-				us = gitblitSettings.getString(Keys.realm.redmine.backingUserService, "${baseFolder}/users.conf");
-			}
+		if (!ext.equals("conf") && !ext.equals("properties") && ext.contains("userservice")) {
+			String realm = ext.substring(0, ext.indexOf("userservice"));
+			us = gitblitSettings.getString(MessageFormat.format("realm.{0}.backingUserService", realm), "${baseFolder}/users.conf");
 		}
 
 		if (us.endsWith(".conf")) {

--
Gitblit v1.9.1