summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core')
-rw-r--r--openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsDaoImpl.java11
-rw-r--r--openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImpl.java9
-rw-r--r--openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/servlet/PermissionsFilter.java3
3 files changed, 19 insertions, 4 deletions
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsDaoImpl.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsDaoImpl.java
index e1a9d1c874..8c62aa02fe 100644
--- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsDaoImpl.java
+++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsDaoImpl.java
@@ -38,7 +38,7 @@ public class ItemPermissionsDaoImpl implements ItemPermissionsDao {
}
@Override
- public String getUserItemPermiission(String itemId, String userId) {
+ public String getUserItemPermission(String itemId, String userId) {
ResultSet result = accessor.getUserItemPermission(itemId,userId);
if (result.getAvailableWithoutFetching() < 1) {
@@ -47,6 +47,11 @@ public class ItemPermissionsDaoImpl implements ItemPermissionsDao {
return result.one().getString(0);
}
+ @Override
+ public void deleteItemPermissions(String itemId) {
+ accessor.deleteItemPermissions(itemId);
+ }
+
@Accessor
interface ItemPermissionsAccessor {
@@ -62,5 +67,9 @@ public class ItemPermissionsDaoImpl implements ItemPermissionsDao {
@Query("insert into dox.item_permissions (item_id,user_id,permission) values (?,?,?)")
void addPermission(String itemId,String userId, String permission);
+ @Query("delete from dox.item_permissions where item_id=?")
+ void deleteItemPermissions(String itemId);
+
+
}
}
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImpl.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImpl.java
index ae40ea8d97..08b51eee86 100644
--- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImpl.java
+++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImpl.java
@@ -53,7 +53,7 @@ public class PermissionsServicesImpl implements PermissionsServices {
@Override
public boolean isAllowed(String itemId,String userId,String action) {
- String userPermission = permissionsDao.getUserItemPermiission(itemId,userId);
+ String userPermission = permissionsDao.getUserItemPermission(itemId,userId);
return permissionsRules.isAllowed(userPermission,action);
}
@@ -64,7 +64,12 @@ public class PermissionsServicesImpl implements PermissionsServices {
@Override
public String getUserItemPermiission(String itemId, String userId) {
- return permissionsDao.getUserItemPermiission(itemId,userId);
+ return permissionsDao.getUserItemPermission(itemId,userId);
+ }
+
+ @Override
+ public void deleteItemPermissions(String itemId) {
+ permissionsDao.deleteItemPermissions(itemId);
}
}
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/servlet/PermissionsFilter.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/servlet/PermissionsFilter.java
index 4a8f44657e..baafb4a9eb 100644
--- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/servlet/PermissionsFilter.java
+++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/servlet/PermissionsFilter.java
@@ -27,6 +27,7 @@ import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.HttpMethod;
import java.io.IOException;
/**
@@ -63,7 +64,7 @@ public class PermissionsFilter implements Filter {
String method = servletRequest.getMethod();
- if (method.equals("POST") || method.equals("PUT")) {
+ if (method.equals(HttpMethod.POST) || method.equals(HttpMethod.PUT) || method.equals(HttpMethod.DELETE)) {
String userId = servletRequest.getHeader("USER_ID");
String itemId = parseItemIdFromPath(servletRequest.getPathInfo());