From 03a03105bc613cf8b87aa67938e9c940197ef511 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Thu, 27 Mar 2014 09:31:57 -0400
Subject: [PATCH] Change build identifier to 1.5.0-SNAPSHOT
---
src/main/java/com/gitblit/models/UserModel.java | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/gitblit/models/UserModel.java b/src/main/java/com/gitblit/models/UserModel.java
index 6419cce..675835d 100644
--- a/src/main/java/com/gitblit/models/UserModel.java
+++ b/src/main/java/com/gitblit/models/UserModel.java
@@ -67,6 +67,7 @@
public boolean canFork;
public boolean canCreate;
public boolean excludeFromFederation;
+ public boolean disabled;
// retained for backwards-compatibility with RPC clients
@Deprecated
public final Set<String> repositories = new HashSet<String>();
@@ -446,6 +447,31 @@
return canAdmin() || model.isUsersPersonalRepository(username) || model.isOwner(username);
}
+ public boolean canEdit(TicketModel ticket, RepositoryModel repository) {
+ return isAuthenticated() &&
+ (canPush(repository)
+ || (ticket != null && username.equals(ticket.responsible))
+ || (ticket != null && username.equals(ticket.createdBy)));
+ }
+
+ public boolean canAdmin(TicketModel ticket, RepositoryModel repository) {
+ return isAuthenticated() &&
+ (canPush(repository)
+ || ticket != null && username.equals(ticket.responsible));
+ }
+
+ public boolean canReviewPatchset(RepositoryModel model) {
+ return isAuthenticated() && canClone(model);
+ }
+
+ public boolean canApprovePatchset(RepositoryModel model) {
+ return isAuthenticated() && canPush(model);
+ }
+
+ public boolean canVetoPatchset(RepositoryModel model) {
+ return isAuthenticated() && canPush(model);
+ }
+
/**
* This returns true if the user has fork privileges or the user has fork
* privileges because of a team membership.
@@ -527,6 +553,10 @@
return false;
}
+ public boolean isAuthenticated() {
+ return !UserModel.ANONYMOUS.equals(this) && isAuthenticated;
+ }
+
public boolean isTeamMember(String teamname) {
for (TeamModel team : teams) {
if (team.name.equalsIgnoreCase(teamname)) {
--
Gitblit v1.9.1