Edit Assignee Permissions
Permission deciding who is able to edit the assignee of a change. Besides the users with edit assignee permission change owner, ref owner, and the currently assigned user are allowed to change the assignee of a change. Change-Id: I7cbc950c66b3d5f1e931d5f8d985d8112682971f
This commit is contained in:
committed by
Sven Selberg
parent
f99aca2f16
commit
a3ca604a6c
@@ -887,6 +887,14 @@ The change owner, branch owners, project owners, and site administrators
|
|||||||
can always edit or remove hashtags (even without having the `Edit Hashtags`
|
can always edit or remove hashtags (even without having the `Edit Hashtags`
|
||||||
access right assigned).
|
access right assigned).
|
||||||
|
|
||||||
|
[[category_edit_assigned_to]]
|
||||||
|
=== Edit Assignee
|
||||||
|
|
||||||
|
This category permits users to set who is assigned to a change that is
|
||||||
|
uploaded for review.
|
||||||
|
|
||||||
|
The change owner, ref owners, and the user currently assigned to a change
|
||||||
|
can always change the assignee.
|
||||||
|
|
||||||
[[example_roles]]
|
[[example_roles]]
|
||||||
== Examples of typical roles in a project
|
== Examples of typical roles in a project
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class Permission implements Comparable<Permission> {
|
|||||||
public static final String CREATE_SIGNED_TAG = "createSignedTag";
|
public static final String CREATE_SIGNED_TAG = "createSignedTag";
|
||||||
public static final String DELETE_DRAFTS = "deleteDrafts";
|
public static final String DELETE_DRAFTS = "deleteDrafts";
|
||||||
public static final String EDIT_HASHTAGS = "editHashtags";
|
public static final String EDIT_HASHTAGS = "editHashtags";
|
||||||
|
public static final String EDIT_ASSIGNEE = "editAssignee";
|
||||||
public static final String EDIT_TOPIC_NAME = "editTopicName";
|
public static final String EDIT_TOPIC_NAME = "editTopicName";
|
||||||
public static final String FORGE_AUTHOR = "forgeAuthor";
|
public static final String FORGE_AUTHOR = "forgeAuthor";
|
||||||
public static final String FORGE_COMMITTER = "forgeCommitter";
|
public static final String FORGE_COMMITTER = "forgeCommitter";
|
||||||
@@ -74,6 +75,7 @@ public class Permission implements Comparable<Permission> {
|
|||||||
NAMES_LC.add(VIEW_DRAFTS.toLowerCase());
|
NAMES_LC.add(VIEW_DRAFTS.toLowerCase());
|
||||||
NAMES_LC.add(EDIT_TOPIC_NAME.toLowerCase());
|
NAMES_LC.add(EDIT_TOPIC_NAME.toLowerCase());
|
||||||
NAMES_LC.add(EDIT_HASHTAGS.toLowerCase());
|
NAMES_LC.add(EDIT_HASHTAGS.toLowerCase());
|
||||||
|
NAMES_LC.add(EDIT_ASSIGNEE.toLowerCase());
|
||||||
NAMES_LC.add(DELETE_DRAFTS.toLowerCase());
|
NAMES_LC.add(DELETE_DRAFTS.toLowerCase());
|
||||||
NAMES_LC.add(PUBLISH_DRAFTS.toLowerCase());
|
NAMES_LC.add(PUBLISH_DRAFTS.toLowerCase());
|
||||||
|
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ permissionNames = \
|
|||||||
createSignedTag, \
|
createSignedTag, \
|
||||||
delete, \
|
delete, \
|
||||||
deleteDrafts, \
|
deleteDrafts, \
|
||||||
|
editAssignee, \
|
||||||
editHashtags, \
|
editHashtags, \
|
||||||
editTopicName, \
|
editTopicName, \
|
||||||
forgeAuthor, \
|
forgeAuthor, \
|
||||||
@@ -150,6 +151,7 @@ createTag = Create Annotated Tag
|
|||||||
createSignedTag = Create Signed Tag
|
createSignedTag = Create Signed Tag
|
||||||
delete = Delete Reference
|
delete = Delete Reference
|
||||||
deleteDrafts = Delete Drafts
|
deleteDrafts = Delete Drafts
|
||||||
|
editAssignee = Edit Assignee
|
||||||
editHashtags = Edit Hashtags
|
editHashtags = Edit Hashtags
|
||||||
editTopicName = Edit Topic Name
|
editTopicName = Edit Topic Name
|
||||||
forgeAuthor = Forge Author Identity
|
forgeAuthor = Forge Author Identity
|
||||||
|
|||||||
@@ -352,6 +352,16 @@ public class ChangeControl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Is this user assigned to this change? */
|
||||||
|
public boolean isAssignee() {
|
||||||
|
Account.Id currentAssignee = notes.getAssignee();
|
||||||
|
if (currentAssignee != null && getUser().isIdentifiedUser()) {
|
||||||
|
Account.Id id = getUser().getAccountId();
|
||||||
|
return id.equals(currentAssignee);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/** Is this user a reviewer for the change? */
|
/** Is this user a reviewer for the change? */
|
||||||
public boolean isReviewer(ReviewDb db) throws OrmException {
|
public boolean isReviewer(ReviewDb db) throws OrmException {
|
||||||
return isReviewer(db, null);
|
return isReviewer(db, null);
|
||||||
@@ -414,6 +424,13 @@ public class ChangeControl {
|
|||||||
return getRefControl().canForceEditTopicName();
|
return getRefControl().canForceEditTopicName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canEditAssignee() {
|
||||||
|
return isOwner()
|
||||||
|
|| getProjectControl().isOwner()
|
||||||
|
|| getRefControl().canEditAssignee()
|
||||||
|
|| isAssignee();
|
||||||
|
}
|
||||||
|
|
||||||
/** Can this user edit the hashtag name? */
|
/** Can this user edit the hashtag name? */
|
||||||
public boolean canEditHashtags() {
|
public boolean canEditHashtags() {
|
||||||
return isOwner() // owner (aka creator) of the change can edit hashtags
|
return isOwner() // owner (aka creator) of the change can edit hashtags
|
||||||
|
|||||||
@@ -447,6 +447,10 @@ public class RefControl {
|
|||||||
return canPerform(Permission.EDIT_HASHTAGS);
|
return canPerform(Permission.EDIT_HASHTAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canEditAssignee() {
|
||||||
|
return canPerform(Permission.EDIT_ASSIGNEE);
|
||||||
|
}
|
||||||
|
|
||||||
/** @return true if this user can force edit topic names. */
|
/** @return true if this user can force edit topic names. */
|
||||||
public boolean canForceEditTopicName() {
|
public boolean canForceEditTopicName() {
|
||||||
return canForcePerform(Permission.EDIT_TOPIC_NAME);
|
return canForcePerform(Permission.EDIT_TOPIC_NAME);
|
||||||
|
|||||||
Reference in New Issue
Block a user