From 88aad76a0e54b4a8757bbc9ea45fec8f70baa832 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 05 Oct 2012 08:16:11 -0400
Subject: [PATCH] Catch all exceptions from MarkdownPapers and rethrow as ParseException (issue 142)
---
src/com/gitblit/models/UserModel.java | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/com/gitblit/models/UserModel.java b/src/com/gitblit/models/UserModel.java
index 0ede878..dd41df0 100644
--- a/src/com/gitblit/models/UserModel.java
+++ b/src/com/gitblit/models/UserModel.java
@@ -36,6 +36,8 @@
private static final long serialVersionUID = 1L;
+ public static final UserModel ANONYMOUS = new UserModel();
+
// field names are reflectively mapped in EditUser page
public String username;
public String password;
@@ -54,6 +56,11 @@
public UserModel(String username) {
this.username = username;
this.isAuthenticated = true;
+ }
+
+ private UserModel() {
+ this.username = "$anonymous";
+ this.isAuthenticated = false;
}
/**
@@ -86,6 +93,16 @@
return false;
}
+ public boolean canViewRepository(RepositoryModel repository) {
+ if (canAdmin) {
+ return true;
+ }
+ if (repository.accessRestriction.atLeast(AccessRestrictionType.VIEW)) {
+ return canAccessRepository(repository);
+ }
+ return true;
+ }
+
public boolean canForkRepository(RepositoryModel repository) {
if (canAdmin) {
return true;
--
Gitblit v1.9.1