summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/models
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-07-13 12:19:02 -0400
committerJames Moger <james.moger@gitblit.com>2013-07-13 12:19:02 -0400
commit139c6da46a9f8beb151d502d3eae555f03ed3302 (patch)
treeb3e709fd8f4b3369f78d82bd5d438b14d7621ec3 /src/main/java/com/gitblit/models
parent58e6f5f9ab7109afa456bb9c9f0547307879f256 (diff)
downloadgitblit-139c6da46a9f8beb151d502d3eae555f03ed3302.tar.gz
gitblit-139c6da46a9f8beb151d502d3eae555f03ed3302.zip
Setting a null permission now removes the permission from the user or team (issue-259)
Diffstat (limited to 'src/main/java/com/gitblit/models')
-rw-r--r--src/main/java/com/gitblit/models/TeamModel.java11
-rw-r--r--src/main/java/com/gitblit/models/UserModel.java8
2 files changed, 16 insertions, 3 deletions
diff --git a/src/main/java/com/gitblit/models/TeamModel.java b/src/main/java/com/gitblit/models/TeamModel.java
index e0499f7c..dfbd45d4 100644
--- a/src/main/java/com/gitblit/models/TeamModel.java
+++ b/src/main/java/com/gitblit/models/TeamModel.java
@@ -186,8 +186,15 @@ public class TeamModel implements Serializable, Comparable<TeamModel> {
}
public void setRepositoryPermission(String repository, AccessPermission permission) {
- permissions.put(repository.toLowerCase(), permission);
- repositories.add(repository.toLowerCase());
+ if (permission == null) {
+ // remove the permission
+ permissions.remove(repository.toLowerCase());
+ repositories.remove(repository.toLowerCase());
+ } else {
+ // set the new permission
+ permissions.put(repository.toLowerCase(), permission);
+ repositories.add(repository.toLowerCase());
+ }
}
public RegistrantAccessPermission getRepositoryPermission(RepositoryModel repository) {
diff --git a/src/main/java/com/gitblit/models/UserModel.java b/src/main/java/com/gitblit/models/UserModel.java
index b480b885..6d585127 100644
--- a/src/main/java/com/gitblit/models/UserModel.java
+++ b/src/main/java/com/gitblit/models/UserModel.java
@@ -273,7 +273,13 @@ public class UserModel implements Principal, Serializable, Comparable<UserModel>
}
public void setRepositoryPermission(String repository, AccessPermission permission) {
- permissions.put(repository.toLowerCase(), permission);
+ if (permission == null) {
+ // remove the permission
+ permissions.remove(repository.toLowerCase());
+ } else {
+ // set the new permission
+ permissions.put(repository.toLowerCase(), permission);
+ }
}
public RegistrantAccessPermission getRepositoryPermission(RepositoryModel repository) {