summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHybris95 <hybris_95@hotmail.com>2014-04-22 12:23:03 +0200
committerJames Moger <james.moger@gitblit.com>2014-05-01 16:14:14 -0400
commit4640f1b689684b805f08a5a937e91dfc65ae977f (patch)
tree48339c5f3d933f581af29f7bea043985ef72e8a0 /src
parente1fa9b763cadcdc44943f805aba83698acafa613 (diff)
downloadgitblit-4640f1b689684b805f08a5a937e91dfc65ae977f.tar.gz
gitblit-4640f1b689684b805f08a5a937e91dfc65ae977f.zip
Now only shows the "my tickets" button in the navbar if you are connected.
Redirects to the main page if you try going on "/mytickets" when not connected (or if you disconnect while being on "/mytickets").
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java6
-rw-r--r--src/main/java/com/gitblit/wicket/pages/RootPage.java17
2 files changed, 15 insertions, 8 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java b/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java
index 2c57a051..9be3b125 100644
--- a/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java
@@ -34,12 +34,14 @@ public class MyTicketsPage extends RootPage {
public MyTicketsPage(PageParameters params)
{
- super();
+ super(params);
setupPage("", getString("gb.mytickets"));
UserModel currentUser = GitBlitWebSession.get().getUser();
if (currentUser == null) {
- currentUser = UserModel.ANONYMOUS;
+ setRedirect(true);
+ setResponsePage(getApplication().getHomePage());
+ return;
}
String username = currentUser.getName();
diff --git a/src/main/java/com/gitblit/wicket/pages/RootPage.java b/src/main/java/com/gitblit/wicket/pages/RootPage.java
index ec413b19..a4d2353d 100644
--- a/src/main/java/com/gitblit/wicket/pages/RootPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/RootPage.java
@@ -134,6 +134,8 @@ public abstract class RootPage extends BasePage {
boolean authenticateView = app().settings().getBoolean(Keys.web.authenticateViewPages, false);
boolean authenticateAdmin = app().settings().getBoolean(Keys.web.authenticateAdminPages, true);
boolean allowAdmin = app().settings().getBoolean(Keys.web.allowAdministration, true);
+ boolean allowLucene = app().settings().getBoolean(Keys.web.allowLuceneIndexing, true);
+ boolean isLoggedIn = GitBlitWebSession.get().isLoggedIn();
if (authenticateAdmin) {
showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin();
@@ -151,7 +153,7 @@ public abstract class RootPage extends BasePage {
}
if (authenticateView || authenticateAdmin) {
- if (GitBlitWebSession.get().isLoggedIn()) {
+ if (isLoggedIn) {
UserMenu userFragment = new UserMenu("userPanel", "userMenuFragment", RootPage.this);
add(userFragment);
} else {
@@ -167,14 +169,17 @@ public abstract class RootPage extends BasePage {
// navigation links
List<PageRegistration> pages = new ArrayList<PageRegistration>();
- if (!authenticateView || (authenticateView && GitBlitWebSession.get().isLoggedIn())) {
- pages.add(new PageRegistration(GitBlitWebSession.get().isLoggedIn() ? "gb.myDashboard" : "gb.dashboard", MyDashboardPage.class,
+ if (!authenticateView || (authenticateView && isLoggedIn)) {
+ pages.add(new PageRegistration(isLoggedIn ? "gb.myDashboard" : "gb.dashboard", MyDashboardPage.class,
getRootPageParameters()));
pages.add(new PageRegistration("gb.repositories", RepositoriesPage.class,
getRootPageParameters()));
pages.add(new PageRegistration("gb.activity", ActivityPage.class, getRootPageParameters()));
- pages.add(new PageRegistration("gb.mytickets", MyTicketsPage.class, getRootPageParameters()));
- if (app().settings().getBoolean(Keys.web.allowLuceneIndexing, true)) {
+ if(isLoggedIn)
+ {
+ pages.add(new PageRegistration("gb.mytickets", MyTicketsPage.class, getRootPageParameters()));
+ }
+ if (allowLucene) {
pages.add(new PageRegistration("gb.search", LuceneSearchPage.class));
}
if (showAdmin) {
@@ -184,7 +189,7 @@ public abstract class RootPage extends BasePage {
pages.add(new PageRegistration("gb.federation", FederationPage.class));
}
- if (!authenticateView || (authenticateView && GitBlitWebSession.get().isLoggedIn())) {
+ if (!authenticateView || (authenticateView && isLoggedIn)) {
addDropDownMenus(pages);
}
}