use of bio.terra.model.PolicyResponse in project jade-data-repo by DataBiosphere.
the class RepositoryApiController method deleteDatasetPolicyMember.
@Override
public ResponseEntity<PolicyResponse> deleteDatasetPolicyMember(@PathVariable("id") String id, @PathVariable("policyName") String policyName, @PathVariable("memberEmail") String memberEmail) {
// member email can't be null since it is part of the URL
if (!ValidationUtils.isValidEmail(memberEmail)) {
throw new ValidationException("InvalidMemberEmail");
}
PolicyModel policy = iamService.deletePolicyMember(getAuthenticatedInfo(), IamResourceType.DATASET, UUID.fromString(id), policyName, memberEmail);
PolicyResponse response = new PolicyResponse().policies(Collections.singletonList(policy));
return new ResponseEntity<>(response, HttpStatus.OK);
}
use of bio.terra.model.PolicyResponse in project jade-data-repo by DataBiosphere.
the class RepositoryApiController method retrieveDatasetPolicies.
@Override
public ResponseEntity<PolicyResponse> retrieveDatasetPolicies(@PathVariable("id") String id) {
List<PolicyModel> policies = iamService.retrievePolicies(getAuthenticatedInfo(), IamResourceType.DATASET, UUID.fromString(id));
PolicyResponse response = new PolicyResponse().policies(policies);
return new ResponseEntity<>(response, HttpStatus.OK);
}
use of bio.terra.model.PolicyResponse in project jade-data-repo by DataBiosphere.
the class RepositoryApiController method deleteSnapshotPolicyMember.
@Override
public ResponseEntity<PolicyResponse> deleteSnapshotPolicyMember(@PathVariable("id") String id, @PathVariable("policyName") String policyName, @PathVariable("memberEmail") String memberEmail) {
// member email can't be null since it is part of the URL
if (!ValidationUtils.isValidEmail(memberEmail)) {
throw new ValidationException("InvalidMemberEmail");
}
PolicyModel policy = iamService.deletePolicyMember(getAuthenticatedInfo(), IamResourceType.DATASNAPSHOT, UUID.fromString(id), policyName, memberEmail);
PolicyResponse response = new PolicyResponse().policies(Collections.singletonList(policy));
return new ResponseEntity<>(response, HttpStatus.OK);
}
use of bio.terra.model.PolicyResponse in project jade-data-repo by DataBiosphere.
the class RepositoryApiController method addDatasetPolicyMember.
// --dataset policies --
@Override
public ResponseEntity<PolicyResponse> addDatasetPolicyMember(@PathVariable("id") String id, @PathVariable("policyName") String policyName, @Valid @RequestBody PolicyMemberRequest policyMember) {
PolicyModel policy = iamService.addPolicyMember(getAuthenticatedInfo(), IamResourceType.DATASET, UUID.fromString(id), policyName, policyMember.getEmail());
PolicyResponse response = new PolicyResponse().policies(Collections.singletonList(policy));
return new ResponseEntity<>(response, HttpStatus.OK);
}
use of bio.terra.model.PolicyResponse in project jade-data-repo by DataBiosphere.
the class RepositoryApiController method addSnapshotPolicyMember.
// --snapshot policies --
@Override
public ResponseEntity<PolicyResponse> addSnapshotPolicyMember(@PathVariable("id") String id, @PathVariable("policyName") String policyName, @Valid @RequestBody PolicyMemberRequest policyMember) {
PolicyModel policy = iamService.addPolicyMember(getAuthenticatedInfo(), IamResourceType.DATASNAPSHOT, UUID.fromString(id), policyName, policyMember.getEmail());
PolicyResponse response = new PolicyResponse().policies(Collections.singletonList(policy));
return new ResponseEntity<>(response, HttpStatus.OK);
}
Aggregations