Add a new permission to permit rebasing changes in the web UI
So far only the change owner and submitters are permitted to rebase a change in the web UI by pushing the 'Rebase Change' button. This change introduces a new access right that can be assigned to other users to permit them to do the rebase in the web UI as well. Change-Id: I21e9981bd685f1d69e792abbd7eeaf1a60d039b8 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:

committed by
Sasa Zivkov

parent
c4fd43d00f
commit
94313bca28
@@ -697,6 +697,21 @@ be suitable in a corporate deployment if the HTTP access control
|
|||||||
is already restricted to the correct set of users.
|
is already restricted to the correct set of users.
|
||||||
|
|
||||||
|
|
||||||
|
[[category_rebase]]
|
||||||
|
Rebase
|
||||||
|
~~~~~~
|
||||||
|
|
||||||
|
This category permits users to rebase changes via the web UI by pushing
|
||||||
|
the `Rebase Change` button.
|
||||||
|
|
||||||
|
The change owner and submitters can always rebase changes in the web UI
|
||||||
|
(even without having the `Rebase` access right assigned).
|
||||||
|
|
||||||
|
Users without this access right who are able to upload new patch sets
|
||||||
|
can still do the rebase locally and upload the rebased commit as a new
|
||||||
|
patch set.
|
||||||
|
|
||||||
|
|
||||||
[[category_submit]]
|
[[category_submit]]
|
||||||
Submit
|
Submit
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
@@ -30,6 +30,7 @@ public class Permission implements Comparable<Permission> {
|
|||||||
public static final String PUSH_MERGE = "pushMerge";
|
public static final String PUSH_MERGE = "pushMerge";
|
||||||
public static final String PUSH_TAG = "pushTag";
|
public static final String PUSH_TAG = "pushTag";
|
||||||
public static final String READ = "read";
|
public static final String READ = "read";
|
||||||
|
public static final String REBASE = "rebase";
|
||||||
public static final String SUBMIT = "submit";
|
public static final String SUBMIT = "submit";
|
||||||
|
|
||||||
private static final List<String> NAMES_LC;
|
private static final List<String> NAMES_LC;
|
||||||
@@ -47,6 +48,7 @@ public class Permission implements Comparable<Permission> {
|
|||||||
NAMES_LC.add(PUSH_MERGE.toLowerCase());
|
NAMES_LC.add(PUSH_MERGE.toLowerCase());
|
||||||
NAMES_LC.add(PUSH_TAG.toLowerCase());
|
NAMES_LC.add(PUSH_TAG.toLowerCase());
|
||||||
NAMES_LC.add(LABEL.toLowerCase());
|
NAMES_LC.add(LABEL.toLowerCase());
|
||||||
|
NAMES_LC.add(REBASE.toLowerCase());
|
||||||
NAMES_LC.add(SUBMIT.toLowerCase());
|
NAMES_LC.add(SUBMIT.toLowerCase());
|
||||||
|
|
||||||
labelIndex = NAMES_LC.indexOf(Permission.LABEL);
|
labelIndex = NAMES_LC.indexOf(Permission.LABEL);
|
||||||
|
@@ -100,6 +100,7 @@ permissionNames = \
|
|||||||
pushMerge, \
|
pushMerge, \
|
||||||
pushTag, \
|
pushTag, \
|
||||||
read, \
|
read, \
|
||||||
|
rebase, \
|
||||||
submit
|
submit
|
||||||
create = Create Reference
|
create = Create Reference
|
||||||
forgeAuthor = Forge Author Identity
|
forgeAuthor = Forge Author Identity
|
||||||
@@ -110,6 +111,7 @@ push = Push
|
|||||||
pushMerge = Push Merge Commit
|
pushMerge = Push Merge Commit
|
||||||
pushTag = Push Annotated Tag
|
pushTag = Push Annotated Tag
|
||||||
read = Read
|
read = Read
|
||||||
|
rebase = Rebase
|
||||||
submit = Submit
|
submit = Submit
|
||||||
|
|
||||||
refErrorEmpty = Reference must be supplied
|
refErrorEmpty = Reference must be supplied
|
||||||
|
@@ -201,7 +201,8 @@ public class ChangeControl {
|
|||||||
|
|
||||||
/** Can this user rebase this change? */
|
/** Can this user rebase this change? */
|
||||||
public boolean canRebase() {
|
public boolean canRebase() {
|
||||||
return isOwner() || getRefControl().canSubmit();
|
return isOwner() || getRefControl().canSubmit()
|
||||||
|
|| getRefControl().canRebase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Can this user restore this change? */
|
/** Can this user restore this change? */
|
||||||
|
@@ -125,6 +125,12 @@ public class RefControl {
|
|||||||
&& canWrite();
|
&& canWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return true if this user can rebase changes on this ref */
|
||||||
|
public boolean canRebase() {
|
||||||
|
return canPerform(Permission.REBASE)
|
||||||
|
&& canWrite();
|
||||||
|
}
|
||||||
|
|
||||||
/** @return true if this user can submit patch sets to this ref */
|
/** @return true if this user can submit patch sets to this ref */
|
||||||
public boolean canSubmit() {
|
public boolean canSubmit() {
|
||||||
if (GitRepositoryManager.REF_CONFIG.equals(refName)) {
|
if (GitRepositoryManager.REF_CONFIG.equals(refName)) {
|
||||||
|
Reference in New Issue
Block a user