Support user consent flow (#1293)
* Introduce user consent flow * Add permissions to confirmation management * rename from consent to confirmation * Reformat code. Remove unused imports. Change and add permission checks when configuring auto-confirmation. * Do not include null values for DDI confirmation base endpoint * fix confirmation required checkbox id * Remove unused import. Fix consume/produce type of new API's. * Change term processing to proceeding when activating user consent flow * Align formatting and extend integration test cases for DMF and DDI. * Extend DMF test cases to consider auto-confirmation * Refactor action management to fix problem of handling action status updates on closed actions. * remove unsupported validation * use new confirmation api for DMF. Extend test cases., * Remove unnecessary fields. * Extend API documentation for DDI and MGMT API. * adapt ddi api docs adoc file * Fixed the duplicate migration version for db files * fix method to support confirmation * Fixed PR comments * Addressed PR comments * Fixed after merge compilation issue * Fixed after merge compilation issue * Fix failing tests in MgmtRolloutResourceTest * Fixed the permissions issue reflected by integration tests * Added back the missing line of code lost during merge * Fix the failing test on Jenkins Signed-off-by: Stanislav Trailov <stanislav.trailov@bosch.io> Signed-off-by: Dimitar Shterev <dimitar.shterev@bosch.io> Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io> Signed-off-by: Shruthi Manavalli Ramanna <shruthimanavalli.ramanna@bosch-si.com> Co-authored-by: Shruthi Manavalli Ramanna <shruthimanavalli.ramanna@bosch-si.com>
This commit is contained in:
@@ -33,6 +33,11 @@ public enum EventTopic {
|
||||
*/
|
||||
UPDATE_ATTRIBUTES,
|
||||
|
||||
/**
|
||||
* Topic when updating auto-confirmation state.
|
||||
*/
|
||||
UPDATE_AUTO_CONFIRM,
|
||||
|
||||
/**
|
||||
* Topic when sending a download only task, skipping the install.
|
||||
*/
|
||||
@@ -56,6 +61,10 @@ public enum EventTopic {
|
||||
/**
|
||||
* Topic when sending a download and install action to multiple devices.
|
||||
*/
|
||||
BATCH_DOWNLOAD_AND_INSTALL
|
||||
BATCH_DOWNLOAD_AND_INSTALL,
|
||||
|
||||
/**
|
||||
* Topic when confirmation of an action is requested.
|
||||
*/
|
||||
CONFIRM
|
||||
}
|
||||
|
||||
@@ -64,5 +64,15 @@ public enum DmfActionStatus {
|
||||
/**
|
||||
* Action has been downloaded for this target.
|
||||
*/
|
||||
DOWNLOADED
|
||||
DOWNLOADED,
|
||||
|
||||
/**
|
||||
* Action is confirmed by the target.
|
||||
*/
|
||||
CONFIRMED,
|
||||
|
||||
/**
|
||||
* Action has been denied by the target.
|
||||
*/
|
||||
DENIED
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ public class DmfActionUpdateStatus {
|
||||
private Long softwareModuleId;
|
||||
|
||||
@JsonProperty
|
||||
private Integer code;
|
||||
private List<String> message;
|
||||
|
||||
@JsonProperty
|
||||
private List<String> message;
|
||||
private Integer code;
|
||||
|
||||
public DmfActionUpdateStatus(@JsonProperty(value = "actionId", required = true) final Long actionId,
|
||||
@JsonProperty(value = "actionStatus", required = true) final DmfActionStatus actionStatus) {
|
||||
@@ -99,4 +99,8 @@ public class DmfActionUpdateStatus {
|
||||
return message.addAll(messages);
|
||||
}
|
||||
|
||||
public void setCode(final int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Bosch.IO GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.dmf.json.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* JSON representation of auto confirmation config.
|
||||
*/
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DmfAutoConfirmation {
|
||||
|
||||
@JsonProperty
|
||||
private boolean enabled;
|
||||
|
||||
@JsonProperty
|
||||
private String initiator;
|
||||
|
||||
@JsonProperty
|
||||
private String remark;
|
||||
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(final boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getInitiator() {
|
||||
return initiator;
|
||||
}
|
||||
|
||||
public void setInitiator(final String initiator) {
|
||||
this.initiator = initiator;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(final String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Bosch.IO GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.dmf.json.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* JSON representation of confirm request.
|
||||
*
|
||||
*/
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DmfConfirmRequest extends DmfActionRequest {
|
||||
|
||||
@JsonProperty
|
||||
private String targetSecurityToken;
|
||||
|
||||
@JsonProperty
|
||||
private List<DmfSoftwareModule> softwareModules;
|
||||
|
||||
public String getTargetSecurityToken() {
|
||||
return targetSecurityToken;
|
||||
}
|
||||
|
||||
public void setTargetSecurityToken(final String targetSecurityToken) {
|
||||
this.targetSecurityToken = targetSecurityToken;
|
||||
}
|
||||
|
||||
public List<DmfSoftwareModule> getSoftwareModules() {
|
||||
if (softwareModules == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(softwareModules);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Software module.
|
||||
*
|
||||
* @param createSoftwareModule
|
||||
* the module
|
||||
*/
|
||||
public void addSoftwareModule(final DmfSoftwareModule createSoftwareModule) {
|
||||
if (softwareModules == null) {
|
||||
softwareModules = new ArrayList<>();
|
||||
}
|
||||
|
||||
softwareModules.add(createSoftwareModule);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user