@@ -152,6 +152,10 @@ public class RepositoryModel implements Serializable, Comparable<RepositoryModel | |||
return !StringUtils.isEmpty(originRepository); | |||
} | |||
public boolean isOwner(String username) { | |||
return owner != null && username != null && owner.equalsIgnoreCase(username); | |||
} | |||
public boolean isPersonalRepository() { | |||
return !StringUtils.isEmpty(projectPath) && projectPath.charAt(0) == '~'; | |||
} |
@@ -59,7 +59,7 @@ public class UserModel implements Principal, Serializable, Comparable<UserModel> | |||
} | |||
private UserModel() { | |||
this.username = "anonymous"; | |||
this.username = "$anonymous"; | |||
this.isAuthenticated = false; | |||
} | |||
@@ -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); | |||