Skip to content

Commit

Permalink
Merge pull request #792 from DataVault/dv5-demo
Browse files Browse the repository at this point in the history
Merge tested changes in dv5-demo to dv5-main
  • Loading branch information
dspeed2 authored Jul 21, 2023
2 parents ff29b50 + d0494b5 commit 861516d
Show file tree
Hide file tree
Showing 27 changed files with 56 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@


@RestController
//@CrossOrigin
@Api(name="Deposits", description = "Interact with DataVault Deposits")
public class DepositsController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.List;

@RestController
//@CrossOrigin
public class FileStoreController {

private static final Logger logger = LoggerFactory.getLogger(FileStoreController.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@


@RestController
//@CrossOrigin
@Slf4j
public class FilesController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.List;

@RestController
//@CrossOrigin
@Api(name="Groups", description = "Interact with DataVault Groups")
public class GroupsController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
import org.jsondoc.core.pojo.ApiVisibility;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
//@CrossOrigin
@Api(name="Index", description = "Show JSONDOC page", visibility = ApiVisibility.PRIVATE)
public class IndexController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
import org.datavaultplatform.common.model.Dataset;
import org.datavaultplatform.broker.services.ExternalMetadataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

@RestController
//@CrossOrigin
public class MetadataController {

private final ExternalMetadataService externalMetadataService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.datavaultplatform.common.model.Agent;

@RestController
//@CrossOrigin
@Api(name="Notify", description = "Inform the broker about an event")
@Slf4j
public class NotifyController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

@RestController
//@CrossOrigin
public class RetentionPoliciesController {

private final RetentionPoliciesService retentionPoliciesService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@


@RestController
//@CrossOrigin
@Api(name="Reviews", description = "Review functions")
public class ReviewsController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.List;

@RestController
//@CrossOrigin
@RequestMapping("/permissions")
@Api(name="Permissions", description = "Interact with DataVault Roles and Permissions")
public class RolesAndPermissionsController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.List;

@RestController
//@CrossOrigin
@Api(name="Statistics", description = "System statistics")
public class StatisticsController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.List;

@RestController
//@CrossOrigin
@Api(name="Users", description = "Interact with DataVault Users")
public class UsersController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@


@RestController
//@CrossOrigin
@Api(name="Vaults", description = "Interact with DataVault Vaults")
public class VaultsController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.List;

@RestController
//@CrossOrigin
public class AdminArchiveStoreController {

private final ArchiveStoreService archiveStoreService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import com.fasterxml.jackson.databind.ObjectMapper;

Expand All @@ -49,6 +44,7 @@


@RestController
//@CrossOrigin
@Api(name="Admin", description = "Administrator functions")
@Slf4j
public class AdminController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
import org.jsondoc.core.annotation.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

@RestController
//@CrossOrigin
@Api(name="AdminPendingVaults", description = "Administrator pending vault functions.")
public class AdminPendingVaultsController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.springframework.web.bind.annotation.*;

@RestController
//@CrossOrigin
@Api(name="AdminRetentionPolicies", description = "Administrator RetentionPolicies functions")
public class AdminRetentionPoliciesController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@


@RestController
//@CrossOrigin
@Api(name="AdminReviews", description = "Administrator Review functions")
public class AdminReviewsController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/

@RestController
//@CrossOrigin
@Api(name="AdminUsers", description = "Administrator User functions")
public class AdminUsersController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import org.apache.commons.collections4.CollectionUtils;
import org.datavaultplatform.broker.services.BillingService;
import org.datavaultplatform.broker.services.ExternalMetadataService;
import org.datavaultplatform.broker.services.RolesAndPermissionsService;
import org.datavaultplatform.broker.services.VaultsService;
import org.datavaultplatform.common.model.BillingInfo;
import org.datavaultplatform.common.model.PendingVault;
import org.datavaultplatform.common.model.User;
import org.datavaultplatform.common.model.Vault;
import org.datavaultplatform.common.response.BillingInformation;
import org.datavaultplatform.common.response.VaultInfo;
Expand All @@ -20,29 +22,26 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import org.springframework.web.bind.annotation.*;


@RestController
//@CrossOrigin
public class BillingController {
private final ExternalMetadataService externalMetadataService;
private final VaultsService vaultsService;
private final BillingService billingService;
private final RolesAndPermissionsService permissionsService;
private static final Logger LOGGER = LoggerFactory.getLogger(BillingController.class);

@Autowired
public BillingController(ExternalMetadataService externalMetadataService,
VaultsService vaultsService, BillingService billingService) {
VaultsService vaultsService, BillingService billingService,
RolesAndPermissionsService permissionsService) {
this.externalMetadataService = externalMetadataService;
this.vaultsService = vaultsService;
this.billingService = billingService;
this.permissionsService = permissionsService;
}

@GetMapping("/admin/billing/search")
Expand All @@ -68,6 +67,13 @@ public VaultsData searchAllBillingVaults(@RequestHeader(HEADER_USER_ID) String u
Map<String, Long> projectSizeMap = vaultsService.getAllProjectsSize();
//update project Size in the response
for(VaultInfo vault: billingResponses) {

User owner = permissionsService.getVaultOwner(vault.getID());
if(owner != null) {
vault.setOwnerId(owner.getID());
vault.setOwnerName(owner.getFirstname() + " " + owner.getLastname());
}

if(vault.getProjectId() != null) {
vault.setProjectSize(projectSizeMap.get(vault.getProjectId()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public FilesService(StorageClassNameResolver resolver) {

//TODO - DHAY this does not seem thread safe
private UserStore userStore;
private final long TIMEOUT_SECONDS = 40;
private final long TIMEOUT_SECONDS = 300;

private boolean connect(FileStore fileStore) {
try {
Expand Down
3 changes: 2 additions & 1 deletion datavault-broker/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ broker.actuator.password=bactorpass
rabbitmq.define.queue.worker=false
rabbitmq.define.queue.broker=false

sftp.driver.use.apache.sshd=false
sftp.driver.use.apache.sshd=false
#spring.mvc.cors.allowed-methods=GET,POST,PUT,DELETE,OPTIONS
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public TivoliStorageManager(String name, Map<String,String> config) {
}
}
locations = new ArrayList<>();
locations.add(TivoliStorageManager.TSM_SERVER_NODE1_OPT);
locations.add(TivoliStorageManager.TSM_SERVER_NODE2_OPT);
locations.add(TivoliStorageManager.TSM_SERVER_NODE1_OPT);
super.multipleCopies = true;
super.depositIdStorageKey = true;
for (String key : config.keySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.Http403ForbiddenEntryPoint;
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;

Expand Down Expand Up @@ -52,7 +53,6 @@ public void configure(WebSecurity web) throws Exception {
protected void configure(HttpSecurity http) throws Exception {

// no form login for 'shib'

HttpSecurityUtils.authorizeRequests(http);

HttpSecurityUtils.sessionManagement(http, sessionRegistry);
Expand Down Expand Up @@ -87,4 +87,14 @@ ShibAuthenticationFilter shibFilter() throws Exception {
return filter;
}

/*@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.authorizeRequests()
.anyRequest()
.authenticated()
.and()
.httpBasic();
http.cors();
return http.build();
}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void exportBillingVaults(HttpServletResponse response,

String[] header = { "Vault name", "Vault Size","Project Id","Project Size","Amount To Be Billed","Amount Billed", "User Name", "Review Date","Creation Time" };

String[] fieldMapping = { "name", "sizeStr","projectId","projectSize","amountToBeBilled","amountBilled", "userName","reviewDate", "CreationTime" };
String[] fieldMapping = { "name", "sizeStr","projectId","projectSize","amountToBeBilled","amountBilled", "ownerName","reviewDate", "CreationTime" };

try {
// uses the Super CSV API to generate CSV data from the model data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<td> <#if vault.getAmountBilled()??>${vault.getAmountBilled()}<#else> </#if></td>

<td>
<#if vault.getUserName()??>${vault.getUserName()}</#if>
<#if vault.getOwnerName()??>${vault.getOwnerName()}</#if>
</td>
<td>
<a href="${springMacroRequestContext.getContextPath()}/admin/billing/${vault.getID()}">Billing Details</a></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ $(document).ready(function(){

// Initially, disable next on doc initialisation
$("input[name=\"billingType\"]").parents("fieldset").children(".next").prop( "disabled", true );
$('#vaultOwner').prop('disabled', true);
//$('#vaultOwner').prop('disabled', true);

$("#billing-choice-na").change(function(){
clearBillingOptions();
Expand Down

0 comments on commit 861516d

Please sign in to comment.