Add permission for pushing signed tag

The method that determines whether or not the user can create a new
Git ref checks if the tag contains a PGP signature, but it returns the
same result in both the `if` and `else` blocks.

The redundant check seems to be legacy of the changes in Idb56f65
where the create ref checks were refactored.  Previously there was a
distinction between permissions to push an annotated tag and to push
a signed tag.  There is now no distinction and the permission is
simply "push tag" (which actually refers to annotated tag).

Add a new permission for pushing signed tag, and use that when the
tag contains a PGP signature.

Change-Id: Ic32e0e60f8518b04e8325653e3e90edee834e629
This commit is contained in:
David Pursehouse
2012-12-12 11:04:40 +09:00
parent 095a25143c
commit b429ce1f50
4 changed files with 23 additions and 4 deletions

View File

@@ -32,6 +32,7 @@ public class Permission implements Comparable<Permission> {
public static final String PUSH = "push";
public static final String PUSH_MERGE = "pushMerge";
public static final String PUSH_TAG = "pushTag";
public static final String PUSH_SIGNED_TAG = "pushSignedTag";
public static final String READ = "read";
public static final String REBASE = "rebase";
public static final String REMOVE_REVIEWER = "removeReviewer";
@@ -53,6 +54,7 @@ public class Permission implements Comparable<Permission> {
NAMES_LC.add(PUSH.toLowerCase());
NAMES_LC.add(PUSH_MERGE.toLowerCase());
NAMES_LC.add(PUSH_TAG.toLowerCase());
NAMES_LC.add(PUSH_SIGNED_TAG.toLowerCase());
NAMES_LC.add(LABEL.toLowerCase());
NAMES_LC.add(REBASE.toLowerCase());
NAMES_LC.add(REMOVE_REVIEWER.toLowerCase());