From 18edd81951a034a2bda9459ff1ef2dcd686eb39b Mon Sep 17 00:00:00 2001 From: James Moger Date: Thu, 29 Nov 2012 18:45:55 -0500 Subject: [PATCH] Hide some user links based on authentication type --- src/com/gitblit/wicket/pages/BasePage.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/com/gitblit/wicket/pages/BasePage.java b/src/com/gitblit/wicket/pages/BasePage.java index d04271db..5721adf7 100644 --- a/src/com/gitblit/wicket/pages/BasePage.java +++ b/src/com/gitblit/wicket/pages/BasePage.java @@ -422,14 +422,19 @@ public abstract class BasePage extends WebPage { public UserFragment(String id, String markupId, MarkupContainer markupProvider) { super(id, markupId, markupProvider); - if (GitBlitWebSession.get().isLoggedIn()) { + GitBlitWebSession session = GitBlitWebSession.get(); + if (session.isLoggedIn()) { + UserModel user = session.getUser(); + boolean editCredentials = GitBlit.self().supportsCredentialChanges(); + boolean standardLogin = session.authenticationType.isStandard(); + // username, logout, and change password - add(new Label("username", GitBlitWebSession.get().getUser().getDisplayName() + ":")); + add(new Label("username", user.getDisplayName() + ":")); add(new LinkPanel("loginLink", null, markupProvider.getString("gb.logout"), - LogoutPage.class)); - boolean editCredentials = GitBlit.self().supportsCredentialChanges(); + LogoutPage.class).setVisible(standardLogin)); + // quick and dirty hack for showing a separator - add(new Label("separator", "|").setVisible(editCredentials)); + add(new Label("separator", "|").setVisible(standardLogin && editCredentials)); add(new BookmarkablePageLink("changePasswordLink", ChangePasswordPage.class).setVisible(editCredentials)); } else { -- 2.39.5