Don't permit project rights to be created backwards
If the min value is larger than the max value, flip the order around the other way. Its likely the user mixed up the fields in the UI. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -211,8 +211,17 @@ public class ProjectAdminServiceImpl extends BaseServiceImplementation
|
||||
|
||||
public void addRight(final Project.Id projectId,
|
||||
final ApprovalCategory.Id categoryId, final String groupName,
|
||||
final short min, final short max,
|
||||
final short amin, final short amax,
|
||||
final AsyncCallback<ProjectDetail> callback) {
|
||||
final short min, max;
|
||||
if (amin <= amax) {
|
||||
min = amin;
|
||||
max = amax;
|
||||
} else {
|
||||
min = amax;
|
||||
max = amin;
|
||||
}
|
||||
|
||||
run(callback, new Action<ProjectDetail>() {
|
||||
public ProjectDetail run(ReviewDb db) throws OrmException, Failure {
|
||||
assertAmProjectOwner(db, projectId);
|
||||
|
@@ -20,4 +20,8 @@ SET max_value = 2
|
||||
WHERE max_value = 1
|
||||
AND category_id = 'pTAG';
|
||||
|
||||
UPDATE project_rights
|
||||
SET min_value = max_value, max_value = min_value
|
||||
WHERE max_value < min_value;
|
||||
|
||||
UPDATE schema_version SET version_nbr = 8;
|
||||
|
Reference in New Issue
Block a user