summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main
diff options
context:
space:
mode:
authorfranciscovila <javier.paradela.vila@est.tech>2022-05-26 10:23:13 +0100
committerMichael Morris <michael.morris@est.tech>2022-05-31 14:27:16 +0000
commitccd6a2c2037610d13769e2759ea5653babf5cacb (patch)
tree04f7105c492a44a845e2c1531ebb911ba301fc69 /openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main
parentb43eb22f91ffdc1e2ba5d82b3dc1a2c4250d06e0 (diff)
Delete VSP - Ensure complete deletion of VSP from DB
Delete data from tables still containing the deleted VSP id Issue-ID: SDC-4023 Signed-off-by: franciscovila <javier.paradela.vila@est.tech> Change-Id: I0b389d22ccba1b888005a5bf3f1af000867e32c1
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main')
-rw-r--r--openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImpl.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImpl.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImpl.java
index 68edb21fd8..d25ea53dc2 100644
--- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImpl.java
@@ -82,7 +82,7 @@ public class PermissionsManagerImpl implements PermissionsManager {
new ErrorCode.ErrorCodeBuilder().withMessage(Messages.PERMISSIONS_ERROR.getErrorMessage()).withId(Messages.PERMISSIONS_ERROR.name())
.withCategory(ErrorCategory.SECURITY).build());
}
- if (permission.equals(PermissionTypes.Owner.name())) {
+ if (permission.equals(PermissionTypes.Owner.name()) && !addedUsersIds.isEmpty()) {
if (addedUsersIds.size() == 1) {
asdcItemManager.updateOwner(itemId, addedUsersIds.iterator().next());
} else {
@@ -96,12 +96,13 @@ public class PermissionsManagerImpl implements PermissionsManager {
private void sendNotifications(String itemId, String permission, Set<String> addedUsersIds, Set<String> removedUsersIds, String userName) {
Item item = asdcItemManager.get(itemId);
+ String itemName = null != item ? item.getName() : "";
addedUsersIds.forEach(affectedUser -> {
- notifyUser(userName, true, item.getName(), itemId, affectedUser, permission);
+ notifyUser(userName, true, itemName, itemId, affectedUser, permission);
subscriptionService.subscribe(affectedUser, itemId);
});
removedUsersIds.forEach(affectedUser -> {
- notifyUser(userName, false, item.getName(), itemId, affectedUser, permission);
+ notifyUser(userName, false, itemName, itemId, affectedUser, permission);
subscriptionService.unsubscribe(affectedUser, itemId);
});
}