ReceiveCommits: Fix PUSH permission check for draft changes

This change fixes PUSH permission check for blocking draft changes:

  [access "refs/drafts/*"]
          push = block group Anonymous Users

MagicBranchInput.parse() method updates the ref name, converting
the refs/drafts/master to refs/heads/master. All checks happens
with refs/heads/master. Only draft flag is set to true to mark the
change as draft.  Use this flag and explicitly call

  controlForRef("refs/drafts/refs/heads/master")

to check PUSH permission is not blocked for the ref.

Change-Id: I236a2969cf16e39198c26ebe1628de5313b660bd
This commit is contained in:
David Ostrovsky
2014-01-21 22:51:47 +01:00
parent 6e43e2aefa
commit 07ddca593b
5 changed files with 159 additions and 1 deletions

View File

@@ -401,6 +401,14 @@ of adding individual reviewers before making the change public to all. The
change page will have a 'Publish' button which allows you to convert individual
draft patch sets of a change into public patch sets for review.
To block push permission to `refs/drafts/*` the following permission rule can
be configured:
====
[access "refs/drafts/*"]
push = block group Anonymous Users
====
[[access_categories]]
Access Categories