From abd3cc2d610981493b5e9333108d271ae37f7726 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sat, 12 Jan 2013 19:51:42 -0500
Subject: [PATCH] Refresh authenticated user model for each page request (issue-186)

---
 docs/04_releases.mkd                       |    3 ++-
 src/com/gitblit/wicket/pages/BasePage.java |    5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd
index d77c732..3d17a9b 100644
--- a/docs/04_releases.mkd
+++ b/docs/04_releases.mkd
@@ -6,7 +6,8 @@
 
 #### fixes
 
-- Fixed nullpointer on recursively calculating folder sizes when there is a named pipe in the hierarchy
+- Fixed nullpointer on recursively calculating folder sizes when there is a named pipe or symlink in the hierarchy
+- Fixed bug where permission changes were not visible in the web ui to a logged-in user until the user logged-out and then logged back in again (issue-186)
 - Fixed nullpointer on creating a repository with mixed case (issue 185)
 - Fixed nullpointer when using web.allowForking = true && git.cacheRepositoryList = false (issue 182)
 - Build project models from the repository model cache, when possible, to reduce page load time (issue 172)
diff --git a/src/com/gitblit/wicket/pages/BasePage.java b/src/com/gitblit/wicket/pages/BasePage.java
index 9f98135..c733c99 100644
--- a/src/com/gitblit/wicket/pages/BasePage.java
+++ b/src/com/gitblit/wicket/pages/BasePage.java
@@ -136,7 +136,10 @@
 	private void login() {
 		GitBlitWebSession session = GitBlitWebSession.get();
 		if (session.isLoggedIn() && !session.isSessionInvalidated()) {
-			// already have a session
+			// already have a session, refresh usermodel to pick up
+			// any changes to permissions or roles (issue-186)
+			UserModel user = GitBlit.self().getUserModel(session.getUser().username);
+			session.setUser(user);
 			return;
 		}
 		

--
Gitblit v1.9.1