diff options
author | ayalaben <Ayala.Benzvi@Amdocs.Com> | 2018-02-11 11:11:00 +0200 |
---|---|---|
committer | ayalaben <ayala.benzvi@amdocs.com> | 2018-02-11 15:27:45 +0200 |
commit | da603323ec3cdf4257707ac1cb4d5d657783ae9f (patch) | |
tree | a8e65ce8629da0e56d5ac7fa7993b518d360a761 /openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src | |
parent | 27fed258bd045e4af8cdc1181ebf3cef8d0822cc (diff) |
Delete Item Draft
Change-Id: I13767ab6a7be82ae89f80d50b5857aabe6e55906
Issue-ID: SDC-1014
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src')
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()); |