Make project state check in DELETE explicit
The majority of code in {Project,Ref,Change}Control is now about
permissions, but not all. Exceptions include checks for a project's
state. This is confusing, because users are presented with an exception
telling them that they lack some kind of permission while the real
reason for the failed operation is that the project's current state
doesn't permit the operation.
This is part of a series of commits to remove all project state checks
from *Control classes and make explicit checks instead.
Change-Id: I261a535527bdfb2ae5449781115537cd7a71082c
This commit is contained in:
@@ -1120,7 +1120,7 @@ class ReceiveCommits {
|
||||
private boolean canDelete(ReceiveCommand cmd) throws PermissionBackendException {
|
||||
try {
|
||||
permissions.ref(cmd.getRefName()).check(RefPermission.DELETE);
|
||||
return true;
|
||||
return projectState.statePermitsWrite();
|
||||
} catch (AuthException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user