Make deleting and publishing drafts a grantable permission

Some site Administrators want to be able to delete or publish draft
changes or patch sets even though they are not the owner.

Allowing members of the Administrators group to do this by default
would not follow the principle that being in the group "does not imply
other access rights", so instead add two new permission categories
"Delete Draft Changes" and "Publish Draft Changes" which can be
granted to the Administrator group, or indeed any other user group.

Bug: Issue 1675
Change-Id: I37083544242a81d3d7fff0950b2edcd9fbe92ebf
This commit is contained in:
David Pursehouse
2012-12-12 11:21:29 +09:00
parent b429ce1f50
commit be7f458826
5 changed files with 47 additions and 2 deletions

View File

@@ -23,12 +23,14 @@ import java.util.List;
public class Permission implements Comparable<Permission> {
public static final String ABANDON = "abandon";
public static final String CREATE = "create";
public static final String DELETE_DRAFTS = "deleteDrafts";
public static final String EDIT_TOPIC_NAME = "editTopicName";
public static final String FORGE_AUTHOR = "forgeAuthor";
public static final String FORGE_COMMITTER = "forgeCommitter";
public static final String FORGE_SERVER = "forgeServerAsCommitter";
public static final String LABEL = "label-";
public static final String OWNER = "owner";
public static final String PUBLISH_DRAFTS = "publishDrafts";
public static final String PUSH = "push";
public static final String PUSH_MERGE = "pushMerge";
public static final String PUSH_TAG = "pushTag";
@@ -61,6 +63,8 @@ public class Permission implements Comparable<Permission> {
NAMES_LC.add(SUBMIT.toLowerCase());
NAMES_LC.add(VIEW_DRAFTS.toLowerCase());
NAMES_LC.add(EDIT_TOPIC_NAME.toLowerCase());
NAMES_LC.add(DELETE_DRAFTS.toLowerCase());
NAMES_LC.add(PUBLISH_DRAFTS.toLowerCase());
labelIndex = NAMES_LC.indexOf(Permission.LABEL);
}