From 63ee41d91854e1cf06d8d5cda30cdf7d8d38f3c5 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Wed, 28 Sep 2011 18:55:34 -0400
Subject: [PATCH] Added IUserService.setup(IStoredSettings) for custom implementations.

---
 docs/01_setup.mkd                    |   10 ++++++++++
 src/com/gitblit/GitBlit.java         |    1 +
 docs/04_releases.mkd                 |    8 ++++++--
 src/com/gitblit/IUserService.java    |   10 ++++++++++
 docs/00_index.mkd                    |   17 +----------------
 src/com/gitblit/FileUserService.java |   10 ++++++++++
 6 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/docs/00_index.mkd b/docs/00_index.mkd
index 0da7f74..856c3eb 100644
--- a/docs/00_index.mkd
+++ b/docs/00_index.mkd
@@ -28,22 +28,7 @@
 
 **%VERSION%** ([go](http://code.google.com/p/gitblit/downloads/detail?name=%GO%)|[war](http://code.google.com/p/gitblit/downloads/detail?name=%WAR%)|[fedclient](http://code.google.com/p/gitblit/downloads/detail?name=%FEDCLIENT%)) based on [%JGIT%][jgit] &nbsp; *released %BUILDDATE%*
 
-- added: federation feature to allow gitblit instances (or gitblit federation clients) to pull repositories and, optionally, settings and accounts from other gitblit instances.  This is something like [svn-sync](http://svnbook.red-bean.com/en/1.5/svn.ref.svnsync.html) for gitblit.
-<br/>**New:** *federation.name =*
-<br/>**New:** *federation.passphrase =*
-<br/>**New:** *federation.allowProposals = false*
-<br/>**New:** *federation.proposalsFolder = proposals*
-<br/>**New:** *federation.defaultFrequency = 60 mins*
-<br/>**New:** *federation.sets =*
-<br/>**New:** *mail.* settings for sending emails
-<br/>**New:** user role *#notfederated* to prevent a user account from being pulled by a federated Gitblit instance
-- added: google-gson dependency
-- added: javamail dependency
-- updated: MarkdownPapers 1.1.1
-- updated: Wicket 1.4.18
-- updated: JGit 1.1.0
-- fixed: syndication urls for WAR deployments
-- fixed: authentication for zip downloads
+- added: IUserService.setup(IStoredSettings) for custom user service implementations
 
 issues, binaries, and sources @ [Google Code][googlecode]<br/>
 sources @ [Github][gitbltsrc]
diff --git a/docs/01_setup.mkd b/docs/01_setup.mkd
index 91900e1..125bac2 100644
--- a/docs/01_setup.mkd
+++ b/docs/01_setup.mkd
@@ -172,6 +172,16 @@
 public interface IUserService {
 
 	/**
+	 * Setup the user service.
+	 * 
+	 * @param settings
+	 * @since 0.6.1
+	 */
+	@Override
+	public void setup(IStoredSettings settings) {
+	}
+	
+	/**
 	 * Does the user service support cookie authentication?
 	 * 
 	 * @return true or false
diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd
index 3941c9f..a77cfd5 100644
--- a/docs/04_releases.mkd
+++ b/docs/04_releases.mkd
@@ -3,6 +3,12 @@
 ### Current Release
 **%VERSION%** ([go](http://code.google.com/p/gitblit/downloads/detail?name=%GO%)|[war](http://code.google.com/p/gitblit/downloads/detail?name=%WAR%)|[fedclient](http://code.google.com/p/gitblit/downloads/detail?name=%FEDCLIENT%)) based on [%JGIT%][jgit] &nbsp; *released %BUILDDATE%*
 
+- added: IUserService.setup(IStoredSettings) for custom user service implementations
+
+### Older Releases
+
+**0.6.0** ([go](http://code.google.com/p/gitblit/downloads/detail?name=gitblit-0.6.0.zip)|[war](http://code.google.com/p/gitblit/downloads/detail?name=gitblit-0.6.0.war)|[fedclient](http://code.google.com/p/gitblit/downloads/detail?name=fedclient-0.6.0.zip)) based on [JGit 1.1.0 (201109151100-r)][jgit] &nbsp; *released 2011-09-27*
+
 - added: federation feature to allow gitblit instances (or gitblit federation clients) to pull repositories and, optionally, settings and accounts from other gitblit instances.  This is something like [svn-sync](http://svnbook.red-bean.com/en/1.5/svn.ref.svnsync.html) for gitblit.
 <br/>**New:** *federation.name =*
 <br/>**New:** *federation.passphrase =*
@@ -19,8 +25,6 @@
 - updated: JGit 1.1.0
 - fixed: syndication urls for WAR deployments
 - fixed: authentication for zip downloads
-
-### Older Releases
 
 **0.5.2** ([go](http://code.google.com/p/gitblit/downloads/detail?name=gitblit-0.5.2.zip)|[war](http://code.google.com/p/gitblit/downloads/detail?name=gitblit-0.5.2.war)) based on [JGit 1.0.0 (201106090707-r)][jgit] &nbsp; *released 2011-07-27*
 
diff --git a/src/com/gitblit/FileUserService.java b/src/com/gitblit/FileUserService.java
index 9dc8008..cae0d79 100644
--- a/src/com/gitblit/FileUserService.java
+++ b/src/com/gitblit/FileUserService.java
@@ -53,6 +53,16 @@
 	}
 
 	/**
+	 * Setup the user service.
+	 * 
+	 * @param settings
+	 * @since 0.6.1
+	 */
+	@Override
+	public void setup(IStoredSettings settings) {
+	}
+
+	/**
 	 * Does the user service support cookie authentication?
 	 * 
 	 * @return true or false
diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java
index f7c43a8..c35340a 100644
--- a/src/com/gitblit/GitBlit.java
+++ b/src/com/gitblit/GitBlit.java
@@ -249,6 +249,7 @@
 	public void setUserService(IUserService userService) {
 		logger.info("Setting up user service " + userService.toString());
 		this.userService = userService;
+		this.userService.setup(settings);
 	}
 
 	/**
diff --git a/src/com/gitblit/IUserService.java b/src/com/gitblit/IUserService.java
index 426d38c..a85c997 100644
--- a/src/com/gitblit/IUserService.java
+++ b/src/com/gitblit/IUserService.java
@@ -29,6 +29,16 @@
 public interface IUserService {
 
 	/**
+	 * Setup the user service. This method allows custom implementations to
+	 * retrieve settings from gitblit.properties or the web.xml file without
+	 * relying on the GitBlit static singleton.
+	 * 
+	 * @param settings
+	 * @since 0.6.1
+	 */
+	void setup(IStoredSettings settings);
+
+	/**
 	 * Does the user service support cookie authentication?
 	 * 
 	 * @return true or false

--
Gitblit v1.9.1