From: James Moger Date: Thu, 29 Nov 2012 23:45:55 +0000 (-0500) Subject: Hide some user links based on authentication type X-Git-Tag: v1.2.0~55 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=18edd81951a034a2bda9459ff1ef2dcd686eb39b;p=gitblit.git Hide some user links based on authentication type --- 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 {