tvaultapi/src/main/java/com/tmobile/cso/vault/api/service/SelfSupportService.java
public ResponseEntity<String> deletefolder(UserDetails userDetails, String path) {
		if (userDetails.isAdmin()) {
			//Taking self service token for safe deletion by admin to avoid the read/deny restriction to admin
			return safesService.deletefolder(userDetails.getSelfSupportToken(), path, userDetails, true);
		}
		else {
			ResponseEntity<String> isAuthorized = isAuthorized(userDetails, path);
			if (!isAuthorized.getStatusCode().equals(HttpStatus.OK)) {
				log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
						put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER).toString()).
						put(LogMessage.ACTION, "deletefolder").
						put(LogMessage.MESSAGE, "Error checking user permission").
						put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL).toString()).
						build()));
				return isAuthorized.getStatusCode().equals(HttpStatus.BAD_REQUEST)?isAuthorized:ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"errors\":[\"Error checking user permission\"]}");
			}
			if (isAuthorized.getBody().equals(TVaultConstants.FALSE)) {
				log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
						put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER).toString()).
						put(LogMessage.ACTION, "deletefolder").
						put(LogMessage.MESSAGE, "Access denied: no permission to delete this safe").
						put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL).toString()).
						build()));
				return ResponseEntity.status(HttpStatus.FORBIDDEN).body("{\"errors\":[\"Access denied: no permission to delete this safe\"]}");
			}
			ResponseEntity<String> safe_creation_response = safesService.deletefolder(userDetails.getSelfSupportToken(), path,userDetails, true);
			return safe_creation_response;
		}
	}
/**
	 * Delete a safe by the user with least privileges, Requires an AppRole which can perform Safe Deletion
	 * (Sufficient access to the paths such as shared or metadata/shared, etc)
	 * @param userDetails
	 * @param userToken
	 * @param path
	 * @return
	 */
Delete a safe by the user with least privileges, Requires an AppRole which can perform Safe Deletion
(Sufficient access to the paths such as shared or metadata/shared, etc)
@param userDetails
@param userToken
@param path
@return
Delete a safe by the user with least privileges Requires an AppRole which can perform Safe Deletion ( Sufficient access to the paths such as shared or metadata / shared etc ) @param userDetails @param userToken @param path @return
public ResponseEntity<String> deletefolder(UserDetails userDetails, String path) {
		if (userDetails.isAdmin()) {
			return safesService.deletefolder(userDetails.getSelfSupportToken(), path, userDetails, true);
		}
		else {
			ResponseEntity<String> isAuthorized = isAuthorized(userDetails, path);
			if (!isAuthorized.getStatusCode().equals(HttpStatus.OK)) {
				log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
						put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER).toString()).
						put(LogMessage.ACTION, "deletefolder").
						put(LogMessage.MESSAGE, "Error checking user permission").
						put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL).toString()).
						build()));
				return isAuthorized.getStatusCode().equals(HttpStatus.BAD_REQUEST)?isAuthorized:ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"errors\":[\"Error checking user permission\"]}");
			}
			if (isAuthorized.getBody().equals(TVaultConstants.FALSE)) {
				log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
						put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER).toString()).
						put(LogMessage.ACTION, "deletefolder").
						put(LogMessage.MESSAGE, "Access denied: no permission to delete this safe").
						put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL).toString()).
						build()));
				return ResponseEntity.status(HttpStatus.FORBIDDEN).body("{\"errors\":[\"Access denied: no permission to delete this safe\"]}");
			}
			ResponseEntity<String> safe_creation_response = safesService.deletefolder(userDetails.getSelfSupportToken(), path,userDetails, true);
			return safe_creation_response;
		}
	}
public ResponseEntity < String > deletefolder ( UserDetails userDetails , String path ) { if ( userDetails . isAdmin ( ) ) { return safesService . deletefolder ( userDetails . getSelfSupportToken ( ) , path , userDetails , true ) ; } else { ResponseEntity < String > isAuthorized = isAuthorized ( userDetails , path ) ; if ( ! isAuthorized . getStatusCode ( ) . equals ( HttpStatus . OK ) ) { log . error ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) . toString ( ) ) . put ( LogMessage . ACTION , "deletefolder" ) . put ( LogMessage . MESSAGE , "Error checking user permission" ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) . toString ( ) ) . build ( ) ) ) ; return isAuthorized . getStatusCode ( ) . equals ( HttpStatus . BAD_REQUEST ) ? isAuthorized : ResponseEntity . status ( HttpStatus . INTERNAL_SERVER_ERROR ) . body ( "{\"errors\":[\"Error checking user permission\"]}" ) ; } if ( isAuthorized . getBody ( ) . equals ( TVaultConstants . FALSE ) ) { log . error ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) . toString ( ) ) . put ( LogMessage . ACTION , "deletefolder" ) . put ( LogMessage . MESSAGE , "Access denied: no permission to delete this safe" ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) . toString ( ) ) . build ( ) ) ) ; return ResponseEntity . status ( HttpStatus . FORBIDDEN ) . body ( "{\"errors\":[\"Access denied: no permission to delete this safe\"]}" ) ; } ResponseEntity < String > safe_creation_response = safesService . deletefolder ( userDetails . getSelfSupportToken ( ) , path , userDetails , true ) ; return safe_creation_response ; } }
Delete a safe by the user with least privileges, Requires an AppRole which can perform Safe Deletion
 (Sufficient access to the paths such as shared or metadata/shared, etc)
 @param userDetails
 @param userToken
 @param path
 @return
Delete a safe by the user with least privileges Requires an AppRole which can perform Safe Deletion ( Sufficient access to the paths such as shared or metadata / shared etc ) @param userDetails @param userToken @param path @return
//Taking self service token for safe deletion by admin to avoid the read/deny restriction to admin
