Remove the non-permission check #isHidden from ProjectControl
PermissionBackend is supposed to only contain permission related checks. Apparently, this #isHidden is a project state check rather than a permission check. Thus it should be removed from the ProjectControl, which is part of the DefaultPermissionBackend. Before removing this, "ACCESS" permission checks for hidden projects will only succeed for the project owners. After removing, they may also succeed for other users, e.g. internal user. The existing checks for "ACCESS" could be divided into two categories base on whether it's helpful for users to change the configuration of the project state or not. For the helpful case, this commit preserves the current behavior of the "ACCESS" check on hidden projects by checking the "READ_CONFIG" permission which will only succeed for the project owners. For the other case, this commit rejects directly even for project owners if the project is hidden. Change-Id: I20743e6380129eea7cb942d8d9ccad314e29d187
This commit is contained in:
@@ -150,6 +150,11 @@ public class EventBroker implements EventDispatcher {
|
||||
|
||||
protected boolean isVisibleTo(Project.NameKey project, CurrentUser user) {
|
||||
try {
|
||||
ProjectState state = projectCache.get(project);
|
||||
if (state == null || !state.statePermitsRead()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
permissionBackend.user(user).project(project).check(ProjectPermission.ACCESS);
|
||||
return true;
|
||||
} catch (AuthException | PermissionBackendException e) {
|
||||
|
||||
Reference in New Issue
Block a user