From 18edd81951a034a2bda9459ff1ef2dcd686eb39b Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> 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 | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/com/gitblit/wicket/pages/BasePage.java b/src/com/gitblit/wicket/pages/BasePage.java index d04271d..5721adf 100644 --- a/src/com/gitblit/wicket/pages/BasePage.java +++ b/src/com/gitblit/wicket/pages/BasePage.java @@ -422,14 +422,19 @@ public UserFragment(String id, String markupId, MarkupContainer markupProvider) { super(id, markupId, markupProvider); - if (GitBlitWebSession.get().isLoggedIn()) { - // username, logout, and change password - add(new Label("username", GitBlitWebSession.get().getUser().getDisplayName() + ":")); - add(new LinkPanel("loginLink", null, markupProvider.getString("gb.logout"), - LogoutPage.class)); + 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", user.getDisplayName() + ":")); + add(new LinkPanel("loginLink", null, markupProvider.getString("gb.logout"), + 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<Void>("changePasswordLink", ChangePasswordPage.class).setVisible(editCredentials)); } else { -- Gitblit v1.9.1