diff options
author | James Moger <james.moger@gitblit.com> | 2013-11-16 11:42:06 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-11-26 16:07:04 -0500 |
commit | 99d0d4fd66f3490b61c700065b7d16bc4e73f226 (patch) | |
tree | 0e5d8bd9e7b14905ab6ea71e8bf6253345415a70 /src/main/java/com/gitblit/wicket/AuthorizationStrategy.java | |
parent | a7a0b8ea01dca14602fdb49047d987c36461e861 (diff) | |
download | gitblit-99d0d4fd66f3490b61c700065b7d16bc4e73f226.tar.gz gitblit-99d0d4fd66f3490b61c700065b7d16bc4e73f226.zip |
Eliminate nearly all direct GitBlit singleton references in Wicket
This is the first step towards modularization and injection. All
direct references to the GitBlit singleton within the Wicket pages
and panels have been replaced to proxy methods in the GitBlitWebApp
singleton. There are still two Wicket classes which rely on the
GitBlit singleton; those require manual instantiation (servlet 3).
Change-Id: I0cdbbcf87959d590c446c99abb09c07c87c737bc
Diffstat (limited to 'src/main/java/com/gitblit/wicket/AuthorizationStrategy.java')
-rw-r--r-- | src/main/java/com/gitblit/wicket/AuthorizationStrategy.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/com/gitblit/wicket/AuthorizationStrategy.java b/src/main/java/com/gitblit/wicket/AuthorizationStrategy.java index a00e2e2f..51ae6481 100644 --- a/src/main/java/com/gitblit/wicket/AuthorizationStrategy.java +++ b/src/main/java/com/gitblit/wicket/AuthorizationStrategy.java @@ -21,7 +21,7 @@ import org.apache.wicket.authorization.IUnauthorizedComponentInstantiationListen import org.apache.wicket.authorization.strategies.page.AbstractPageAuthorizationStrategy;
import org.apache.wicket.markup.html.WebPage;
-import com.gitblit.GitBlit;
+import com.gitblit.IStoredSettings;
import com.gitblit.Keys;
import com.gitblit.models.UserModel;
import com.gitblit.wicket.pages.BasePage;
@@ -29,9 +29,11 @@ import com.gitblit.wicket.pages.BasePage; public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy implements
IUnauthorizedComponentInstantiationListener {
+ IStoredSettings settings;
Class<? extends WebPage> homepageClass;
- public AuthorizationStrategy(Class<? extends WebPage> homepageClass) {
+ public AuthorizationStrategy(IStoredSettings settings, Class<? extends WebPage> homepageClass) {
+ this.settings = settings;
this.homepageClass = homepageClass;
}
@@ -45,9 +47,9 @@ public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy imp }
if (BasePage.class.isAssignableFrom(pageClass)) {
- boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);
- boolean authenticateAdmin = GitBlit.getBoolean(Keys.web.authenticateAdminPages, true);
- boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, true);
+ boolean authenticateView = settings.getBoolean(Keys.web.authenticateViewPages, true);
+ boolean authenticateAdmin = settings.getBoolean(Keys.web.authenticateAdminPages, true);
+ boolean allowAdmin = settings.getBoolean(Keys.web.allowAdministration, true);
GitBlitWebSession session = GitBlitWebSession.get();
if (authenticateView && !session.isLoggedIn()) {
|