use of bio.terra.model.PolicyModel in project jade-data-repo by DataBiosphere.
the class SamIam method deletePolicyMemberInner.
private PolicyModel deletePolicyMemberInner(AuthenticatedUserRequest userReq, IamResourceType iamResourceType, UUID resourceId, String policyName, String userEmail) throws ApiException {
ResourcesApi samResourceApi = samResourcesApi(userReq.getRequiredToken());
samResourceApi.removeUserFromPolicy(iamResourceType.toString(), resourceId.toString(), policyName, userEmail);
AccessPolicyMembership result = samResourceApi.getPolicy(iamResourceType.toString(), resourceId.toString(), policyName);
return new PolicyModel().name(policyName).members(result.getMemberEmails());
}
use of bio.terra.model.PolicyModel 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.PolicyModel 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