diff options
author | ayalaben <Ayala.Benzvi@Amdocs.Com> | 2017-12-27 12:05:35 +0200 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2017-12-31 08:08:20 +0000 |
commit | 5eb33aa2b4a62c60c7296e17e165b8bdf2a81016 (patch) | |
tree | 2dabefac3eef14969a533213689be24d6b5f11fc /openecomp-be/backend/openecomp-sdc-item-permissions-manager | |
parent | ed9d494caf774e4340bf9ac0fbf4e4436ef9750e (diff) |
Add Item Owner to item
Change-Id: I91ce289159057bd5c179c64131d74a24aa83ac9f
Issue-ID: SDC-800
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-item-permissions-manager')
-rw-r--r-- | openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java index b9fcfcdbed..726695b0c8 100644 --- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java @@ -7,6 +7,7 @@ import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.common.session.SessionContextProviderFactory; import org.openecomp.sdc.itempermissions.ItemPermissionsManager; import org.openecomp.sdc.itempermissions.PermissionsServices; +import org.openecomp.sdc.itempermissions.impl.types.PermissionTypes; import org.openecomp.sdc.itempermissions.type.ItemPermissionsEntity; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; @@ -71,8 +72,20 @@ public class ItemPermissionsManagerImpl implements ItemPermissionsManager { .withCategory(ErrorCategory.SECURITY).build()); } + if (permission.equals(PermissionTypes.Owner.name()) ){ + if (addedUsersIds.size() == 1){ + itemManager.updateOwner(itemId,addedUsersIds.iterator().next()); + } else { + throw new CoreException(new ErrorCode.ErrorCodeBuilder() + .withMessage(Messages.PERMISSIONS_OWNER_ERROR.getErrorMessage()) + .withId(Messages.PERMISSIONS_OWNER_ERROR.getErrorMessage()) + .withCategory(ErrorCategory.SECURITY).build()); + } + } + permissionsServices .updateItemPermissions(itemId, permission, addedUsersIds, removedUsersIds); + sendNotifications(itemId, permission, addedUsersIds, removedUsersIds, currentUser); } |