]> source.dussan.org Git - gitblit.git/commitdiff
Hide some user links based on authentication type
authorJames Moger <james.moger@gitblit.com>
Thu, 29 Nov 2012 23:45:55 +0000 (18:45 -0500)
committerJames Moger <james.moger@gitblit.com>
Thu, 29 Nov 2012 23:45:55 +0000 (18:45 -0500)
src/com/gitblit/wicket/pages/BasePage.java

index d04271db92795be9d80cd0de6df4d0bf7b6f34c5..5721adf7a3975ea01081913e6d15e25f27672274 100644 (file)
@@ -422,14 +422,19 @@ public abstract class BasePage extends WebPage {
                public UserFragment(String id, String markupId, MarkupContainer markupProvider) {\r
                        super(id, markupId, markupProvider);\r
 \r
-                       if (GitBlitWebSession.get().isLoggedIn()) {\r
+                       GitBlitWebSession session = GitBlitWebSession.get();\r
+                       if (session.isLoggedIn()) {                             \r
+                               UserModel user = session.getUser();\r
+                               boolean editCredentials = GitBlit.self().supportsCredentialChanges();\r
+                               boolean standardLogin = session.authenticationType.isStandard();\r
+\r
                                // username, logout, and change password\r
-                               add(new Label("username", GitBlitWebSession.get().getUser().getDisplayName() + ":"));\r
+                               add(new Label("username", user.getDisplayName() + ":"));\r
                                add(new LinkPanel("loginLink", null, markupProvider.getString("gb.logout"),\r
-                                               LogoutPage.class));\r
-                               boolean editCredentials = GitBlit.self().supportsCredentialChanges();\r
+                                               LogoutPage.class).setVisible(standardLogin));\r
+                               \r
                                // quick and dirty hack for showing a separator\r
-                               add(new Label("separator", "|").setVisible(editCredentials));\r
+                               add(new Label("separator", "|").setVisible(standardLogin && editCredentials));\r
                                add(new BookmarkablePageLink<Void>("changePasswordLink", \r
                                                ChangePasswordPage.class).setVisible(editCredentials));\r
                        } else {\r