From 22fb6d661b72bcb99e467c2289257d360d5e13a9 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Tue, 28 Jan 2020 12:36:50 +0200 Subject: Rename Role's subscriberId field It was named subscriberName, although containing the id. Issue-ID: VID-758 Change-Id: I28fd174a6eab642d34aef207e9d3ca69e8091884 Signed-off-by: Ittay Stern --- .../java/org/onap/vid/roles/AlwaysValidRoleValidator.java | 4 ++-- vid-app-common/src/main/java/org/onap/vid/roles/Role.java | 14 +++++++------- .../src/main/java/org/onap/vid/roles/RoleValidator.java | 4 ++-- .../org/onap/vid/roles/RoleValidatorByOwningEntity.java | 4 ++-- .../vid/roles/RoleValidatorBySubscriberAndServiceType.java | 10 +++++----- .../main/java/org/onap/vid/roles/RoleValidatorsComposer.kt | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) (limited to 'vid-app-common/src/main/java/org/onap') diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java b/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java index e12f5403f..66eab1810 100644 --- a/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java +++ b/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java @@ -27,7 +27,7 @@ public class AlwaysValidRoleValidator implements RoleValidator { } @Override - public boolean isSubscriberPermitted(String subscriberName) { + public boolean isSubscriberPermitted(String subscriberId) { return true; } @@ -37,7 +37,7 @@ public class AlwaysValidRoleValidator implements RoleValidator { } @Override - public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName) { + public boolean isTenantPermitted(String subscriberId, String serviceType, String tenantName) { return true; } } diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/Role.java b/vid-app-common/src/main/java/org/onap/vid/roles/Role.java index 454483031..3d94dc00a 100644 --- a/vid-app-common/src/main/java/org/onap/vid/roles/Role.java +++ b/vid-app-common/src/main/java/org/onap/vid/roles/Role.java @@ -28,15 +28,15 @@ public class Role { private EcompRole ecompRole; - private String subscribeName; + private String subscriberId; private String serviceType; private String tenant; - public Role(EcompRole ecompRole, String subscribeName, String serviceType, String tenant) { + public Role(EcompRole ecompRole, String subscriberId, String serviceType, String tenant) { this.ecompRole = ecompRole; - this.subscribeName = subscribeName; + this.subscriberId = subscriberId; this.serviceType = serviceType; this.tenant = tenant; } @@ -46,12 +46,12 @@ public class Role { } - public String getSubscribeName() { - return subscribeName; + public String getSubscriberId() { + return subscriberId; } - public void setSubscribeName(String subscribeName) { - this.subscribeName = subscribeName; + public void setSubscriberId(String subscriberId) { + this.subscriberId = subscriberId; } public String getServiceType() { diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java index 4ad168c4f..ed280c8b8 100644 --- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java +++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java @@ -38,9 +38,9 @@ public interface RoleValidator { : new RoleValidatorBySubscriberAndServiceType(roles); } - boolean isSubscriberPermitted(String subscriberName); + boolean isSubscriberPermitted(String subscriberId); boolean isServicePermitted(WithPermissionProperties serviceInstanceSearchResult); - boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName); + boolean isTenantPermitted(String subscriberId, String serviceType, String tenantName); } diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByOwningEntity.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByOwningEntity.java index 726567cc6..50fc1091e 100644 --- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByOwningEntity.java +++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByOwningEntity.java @@ -28,7 +28,7 @@ public class RoleValidatorByOwningEntity implements RoleValidator{ } @Override - public boolean isSubscriberPermitted(String subscriberName) { + public boolean isSubscriberPermitted(String subscriberId) { return false; } @@ -38,7 +38,7 @@ public class RoleValidatorByOwningEntity implements RoleValidator{ } @Override - public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName) { + public boolean isTenantPermitted(String subscriberId, String serviceType, String tenantName) { return false; } } diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceType.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceType.java index 95d8a1627..1e0f9f461 100644 --- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceType.java +++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceType.java @@ -31,9 +31,9 @@ public class RoleValidatorBySubscriberAndServiceType implements RoleValidator { } @Override - public boolean isSubscriberPermitted(String subscriberName) { + public boolean isSubscriberPermitted(String subscriberId) { for (Role role : userRoles) { - if (role.getSubscribeName().equals(subscriberName)) { + if (role.getSubscriberId().equals(subscriberId)) { return true; } } @@ -43,7 +43,7 @@ public class RoleValidatorBySubscriberAndServiceType implements RoleValidator { @Override public boolean isServicePermitted(WithPermissionProperties permissionProperties) { for (Role role : userRoles) { - if (role.getSubscribeName().equals(permissionProperties.getSubscriberId()) && role.getServiceType().equals(permissionProperties.getServiceType())) { + if (role.getSubscriberId().equals(permissionProperties.getSubscriberId()) && role.getServiceType().equals(permissionProperties.getServiceType())) { return true; } } @@ -51,9 +51,9 @@ public class RoleValidatorBySubscriberAndServiceType implements RoleValidator { } @Override - public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName) { + public boolean isTenantPermitted(String subscriberId, String serviceType, String tenantName) { for (Role role : userRoles) { - if (role.getSubscribeName().equals(globalCustomerId) + if (role.getSubscriberId().equals(subscriberId) && role.getServiceType().equals(serviceType) && (role.getTenant() == null || role.getTenant().equalsIgnoreCase(tenantName))) { return true; diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt index 873622389..d012cb3f3 100644 --- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt +++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt @@ -7,10 +7,10 @@ class RoleValidatorsComposer(private vararg val roleValidators: RoleValidator) : override fun isServicePermitted(p: WithPermissionProperties): Boolean = roleValidators.any { it.isServicePermitted(p) } - override fun isSubscriberPermitted(subscriberName: String?): Boolean = - roleValidators.any { it.isSubscriberPermitted(subscriberName) } + override fun isSubscriberPermitted(subscriberId: String?): Boolean = + roleValidators.any { it.isSubscriberPermitted(subscriberId) } - override fun isTenantPermitted(globalCustomerId: String?, serviceType: String?, tenantName: String?): Boolean = - roleValidators.any { it.isTenantPermitted(globalCustomerId, serviceType, tenantName) } + override fun isTenantPermitted(subscriberId: String?, serviceType: String?, tenantName: String?): Boolean = + roleValidators.any { it.isTenantPermitted(subscriberId, serviceType, tenantName) } } -- cgit 1.2.3-korg