Reduce usage of ChangeControl

Reduce the usage of ChangeControl by replacing it with ChangeNotes and
CurrentUser where it was just used as a container for these.

Change return type of ChangeResource#getUser from IdentifiedUser to
CurrentUser to be more versatile and allow individual endpoints to check
if the user is an identified user. Since anonymous users can also
access some change resources it seems more consistent to only assume
that we can get a CurrentUser from ChangeResource.

Eventually, {Ref,Change,Project}Control should be package-private. This
commit is an incremental step towards that goal.

Change-Id: I6790f6f9d56240a96aa007bae140422b71c59750
This commit is contained in:
Patrick Hiesel
2017-08-25 16:49:25 +02:00
parent ef213fd3e0
commit 42eda45540
34 changed files with 184 additions and 232 deletions

View File

@@ -133,7 +133,7 @@ public class CatServlet extends HttpServlet {
.check(ChangePermission.READ);
if (patchKey.getParentKey().get() == 0) {
// change edit
Optional<ChangeEdit> edit = changeEditUtil.byChange(notes.getChange());
Optional<ChangeEdit> edit = changeEditUtil.byChange(notes);
if (edit.isPresent()) {
revision = ObjectId.toString(edit.get().getEditCommit());
} else {