From cca55e4722fa1ceba8a0933dda974162635f3955 Mon Sep 17 00:00:00 2001
From: John Crygier <john.crygier@aon.com>
Date: Thu, 03 May 2012 12:48:16 -0400
Subject: [PATCH] Ability to get / set "custom" properties within a RepositoryModel. This makes getting specialized settings in hooks much easier.
---
src/com/gitblit/models/UserModel.java | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/com/gitblit/models/UserModel.java b/src/com/gitblit/models/UserModel.java
index bd8974d..b0e57fd 100644
--- a/src/com/gitblit/models/UserModel.java
+++ b/src/com/gitblit/models/UserModel.java
@@ -37,6 +37,8 @@
// field names are reflectively mapped in EditUser page
public String username;
public String password;
+ public String displayName;
+ public String emailAddress;
public boolean canAdmin;
public boolean excludeFromFederation;
public final Set<String> repositories = new HashSet<String>();
@@ -96,10 +98,29 @@
return false;
}
+ public TeamModel getTeam(String teamname) {
+ if (teams == null) {
+ return null;
+ }
+ for (TeamModel team : teams) {
+ if (team.name.equalsIgnoreCase(teamname)) {
+ return team;
+ }
+ }
+ return null;
+ }
+
@Override
public String getName() {
return username;
}
+
+ public String getDisplayName() {
+ if (StringUtils.isEmpty(displayName)) {
+ return username;
+ }
+ return displayName;
+ }
@Override
public String toString() {
--
Gitblit v1.9.1