summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/gitblit/utils')
-rw-r--r--src/main/java/com/gitblit/utils/ModelUtils.java12
-rw-r--r--src/main/java/com/gitblit/utils/RpcUtils.java35
2 files changed, 46 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/utils/ModelUtils.java b/src/main/java/com/gitblit/utils/ModelUtils.java
index 6fb4c0ac..74e97abb 100644
--- a/src/main/java/com/gitblit/utils/ModelUtils.java
+++ b/src/main/java/com/gitblit/utils/ModelUtils.java
@@ -56,6 +56,16 @@ public class ModelUtils
return userRepoPrefix;
}
+ /**
+ * Get the user project name for a user.
+ *
+ * @param username name of user
+ * @return the active user repository project prefix concatenated with the user name
+ */
+ public static String getPersonalProject(String username)
+ {
+ return userRepoPrefix + username.toLowerCase();
+ }
/**
* Get the user project name for a user.
@@ -65,7 +75,7 @@ public class ModelUtils
*/
public static String getPersonalPath(String username)
{
- return userRepoPrefix + username.toLowerCase();
+ return userRepoPrefix + username.toLowerCase() + "/";
}
diff --git a/src/main/java/com/gitblit/utils/RpcUtils.java b/src/main/java/com/gitblit/utils/RpcUtils.java
index 82202154..21841acc 100644
--- a/src/main/java/com/gitblit/utils/RpcUtils.java
+++ b/src/main/java/com/gitblit/utils/RpcUtils.java
@@ -461,6 +461,41 @@ public class RpcUtils {
}
/**
+ * Retrieves the list of owners for the specified repository.
+ *
+ * @param repository
+ * @param serverUrl
+ * @param account
+ * @param password
+ * @return list of owners
+ * @throws IOException
+ */
+ public static List<String> getRepositoryOwners(RepositoryModel repository,
+ String serverUrl, String account, char [] password) throws IOException {
+ String url = asLink(serverUrl, RpcRequest.LIST_REPOSITORY_OWNERS, repository.name);
+ Collection<String> list = JsonUtils.retrieveJson(url, NAMES_TYPE, account, password);
+ return new ArrayList<String>(list);
+ }
+
+ /**
+ * Sets the repository owners
+ *
+ * @param repository
+ * @param owners
+ * @param serverUrl
+ * @param account
+ * @param password
+ * @return true if the action succeeded
+ * @throws IOException
+ */
+ public static boolean setRepositoryOwners(RepositoryModel repository,
+ List<String> owners, String serverUrl, String account, char[] password)
+ throws IOException {
+ return doAction(RpcRequest.SET_REPOSITORY_OWNERS, repository.name, owners, serverUrl,
+ account, password);
+ }
+
+ /**
* Retrieves the list of teams that can access the specified repository.
*
* @param repository