Skip to content

Commit 139c6da

Browse files
committed
Setting a null permission now removes the permission from the user or team (issue-259)
1 parent 58e6f5f commit 139c6da

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

releases.moxie

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ r17: {
4949
- Improve NPE handling for hook script enumeration (issue-253)
5050
- Workaround missing commit information in blame page (JGit bug 374382, issue-254)
5151
- Ignore orphan ".git" folder in the repositories root folder (issue-256)
52+
- Fixed bug where a null permission was added to a user model on a repository rename when the permission had really been inherited from a team membership (issue-259)
5253
- Fixed committer verification with merge commits (issue-264)
5354
- Could not reset settings with $ or { characters through Gitblit Manager because they are not properly escaped
5455
- Added more error checking to blob page and blame page

src/main/java/com/gitblit/models/TeamModel.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,15 @@ public AccessPermission removeRepositoryPermission(String name) {
186186
}
187187

188188
public void setRepositoryPermission(String repository, AccessPermission permission) {
189-
permissions.put(repository.toLowerCase(), permission);
190-
repositories.add(repository.toLowerCase());
189+
if (permission == null) {
190+
// remove the permission
191+
permissions.remove(repository.toLowerCase());
192+
repositories.remove(repository.toLowerCase());
193+
} else {
194+
// set the new permission
195+
permissions.put(repository.toLowerCase(), permission);
196+
repositories.add(repository.toLowerCase());
197+
}
191198
}
192199

193200
public RegistrantAccessPermission getRepositoryPermission(RepositoryModel repository) {

src/main/java/com/gitblit/models/UserModel.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,13 @@ public AccessPermission removeRepositoryPermission(String name) {
273273
}
274274

275275
public void setRepositoryPermission(String repository, AccessPermission permission) {
276-
permissions.put(repository.toLowerCase(), permission);
276+
if (permission == null) {
277+
// remove the permission
278+
permissions.remove(repository.toLowerCase());
279+
} else {
280+
// set the new permission
281+
permissions.put(repository.toLowerCase(), permission);
282+
}
277283
}
278284

279285
public RegistrantAccessPermission getRepositoryPermission(RepositoryModel repository) {

0 commit comments

Comments
 (0)