diff options
author | talig <talig@amdocs.com> | 2018-05-23 11:38:51 +0300 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-05-23 09:09:03 +0000 |
commit | 66b0d09b07a0d16daacbb4c08da8cfe7e55bc28b (patch) | |
tree | f94de8fab9b97733fcc1a70fbf4fd4ba5eb008fc /openecomp-be/api | |
parent | 134783cf629d515f35df39d1e0a583ecf8ffdc56 (diff) |
Fix bug in change item owner
Change-Id: I200387d41f95d61ad0f6be6663b8d8fac198aa90
Issue-ID: SDC-1355
Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/api')
2 files changed, 10 insertions, 8 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java index f596a8dd1b..3f4749d98d 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java @@ -300,9 +300,10 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels { } private boolean userHasPermission(String itemId, String userId) { - String permission = permissionsManager.getUserItemPermission(itemId, userId); - return (permission != null && permission.matches( - PermissionTypes.Contributor.name() + "|" + PermissionTypes.Owner.name())); + return permissionsManager.getUserItemPermission(itemId, userId) + .map(permission -> permission + .matches(PermissionTypes.Contributor.name() + "|" + PermissionTypes.Owner.name())) + .orElse(false); } private Predicate<Item> createItemPredicate(String versionStatus, String itemStatus, String user) { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java index 9610da8553..03f36978cf 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java @@ -585,11 +585,12 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { } } - private boolean userHasPermission(String itemId, String userId) { - String permission = permissionsManager.getUserItemPermission(itemId, userId); - return permission != null && permission - .matches(PermissionTypes.Contributor.name() + "|" + PermissionTypes.Owner.name()); - } + private boolean userHasPermission(String itemId, String userId) { + return permissionsManager.getUserItemPermission(itemId, userId) + .map(permission -> permission + .matches(PermissionTypes.Contributor.name() + "|" + PermissionTypes.Owner.name())) + .orElse(false); + } private Predicate<Item> createItemPredicate(String versionStatus, String itemStatus, |