Merge "Make the ability to remove reviewers a grantable permission"

This commit is contained in:
Shawn Pearce
2012-09-16 12:16:54 -07:00
committed by gerrit code review
5 changed files with 27 additions and 3 deletions

View File

@@ -282,9 +282,10 @@ public class ChangeControl {
return true;
}
// The branch owner, project owner, site admin can remove anyone.
//
if (getRefControl().isOwner() // branch owner
// Users with the remove reviewer permission, the branch owner, project
// owner and site admin can remove anyone
if (getRefControl().canRemoveReviewer() // has removal permissions
|| getRefControl().isOwner() // branch owner
|| getProjectControl().isOwner() // project owner
|| getCurrentUser().getCapabilities().canAdministrateServer()) {
return true;

View File

@@ -322,6 +322,11 @@ public class RefControl {
return canPerform(Permission.ABANDON);
}
/** @return true if this user can remove a reviewer for a change. */
public boolean canRemoveReviewer() {
return canPerform(Permission.REMOVE_REVIEWER);
}
/** All value ranges of any allowed label permission. */
public List<PermissionRange> getLabelRanges() {
List<PermissionRange> r = new ArrayList<PermissionRange>();