From: James Moger Date: Wed, 3 Oct 2012 21:50:48 +0000 (-0400) Subject: Fix anonymous browsing of user profile page X-Git-Tag: v1.2.0~185 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ec0ce1621a3e145d5786c0c26caffd0c5c3acd61;p=gitblit.git Fix anonymous browsing of user profile page --- diff --git a/src/com/gitblit/models/RepositoryModel.java b/src/com/gitblit/models/RepositoryModel.java index 65629faf..caf7e7e4 100644 --- a/src/com/gitblit/models/RepositoryModel.java +++ b/src/com/gitblit/models/RepositoryModel.java @@ -152,6 +152,10 @@ public class RepositoryModel implements Serializable, Comparable } private UserModel() { - this.username = "anonymous"; + this.username = "$anonymous"; this.isAuthenticated = false; } diff --git a/src/com/gitblit/wicket/panels/ProjectRepositoryPanel.java b/src/com/gitblit/wicket/panels/ProjectRepositoryPanel.java index 0a6bc623..50f0d52d 100644 --- a/src/com/gitblit/wicket/panels/ProjectRepositoryPanel.java +++ b/src/com/gitblit/wicket/panels/ProjectRepositoryPanel.java @@ -134,8 +134,11 @@ public class ProjectRepositoryPanel extends BasePanel { } UserModel user = GitBlitWebSession.get().getUser(); + if (user == null) { + user = UserModel.ANONYMOUS; + } Fragment repositoryLinks; - boolean showOwner = user != null && user.username.equalsIgnoreCase(entry.owner); + boolean showOwner = entry.isOwner(user.username); // owner of personal repository gets admin powers boolean showAdmin = isAdmin || entry.isUsersPersonalRepository(user.username);