summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java7
-rw-r--r--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.java11
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,