use of com.walmartlabs.concord.server.GenericOperationResult in project concord by walmartlabs.
the class SecretResource method updateAccessLevel.
@POST
@ApiOperation("Updates the access level for the specified secret and team")
@Path("/{orgName}/secret/{secretName}/access/bulk")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Validate
public GenericOperationResult updateAccessLevel(@ApiParam @PathParam("orgName") @ConcordKey String orgName, @ApiParam @PathParam("secretName") @ConcordKey String secretName, @ApiParam @Valid Collection<ResourceAccessEntry> entries) {
OrganizationEntry org = orgManager.assertAccess(orgName, true);
UUID secretId = secretDao.getId(org.getId(), secretName);
if (secretId == null) {
throw new ConcordApplicationException("Secret not found: " + secretName, Status.NOT_FOUND);
}
if (entries == null) {
throw new ConcordApplicationException("List of teams is null.", Status.BAD_REQUEST);
}
secretManager.updateAccessLevel(secretId, entries, true);
return new GenericOperationResult(OperationResult.UPDATED);
}
use of com.walmartlabs.concord.server.GenericOperationResult in project concord by walmartlabs.
the class SecretResource method updateAccessLevel.
@POST
@ApiOperation("Updates the access level for the specified secret and team")
@Path("/{orgName}/secret/{secretName}/access")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Validate
public GenericOperationResult updateAccessLevel(@ApiParam @PathParam("orgName") @ConcordKey String orgName, @ApiParam @PathParam("secretName") @ConcordKey String secretName, @ApiParam @Valid ResourceAccessEntry entry) {
OrganizationEntry org = orgManager.assertAccess(orgName, true);
UUID secretId = secretDao.getId(org.getId(), secretName);
if (secretId == null) {
throw new ConcordApplicationException("Secret not found: " + secretName, Status.NOT_FOUND);
}
UUID teamId = ResourceAccessUtils.getTeamId(orgDao, teamDao, org.getId(), entry);
secretManager.updateAccessLevel(secretId, teamId, entry.getLevel());
return new GenericOperationResult(OperationResult.UPDATED);
}
use of com.walmartlabs.concord.server.GenericOperationResult in project concord by walmartlabs.
the class PolicyResource method link.
@PUT
@ApiOperation("Link an existing policy to an organization, a project or user")
@Path("/{policyName}/link")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public GenericOperationResult link(@ApiParam @PathParam("policyName") @ConcordKey String policyName, @ApiParam @Valid PolicyLinkEntry entry) {
assertAdmin();
// TODO: add user type into request
UserType userType = UserPrincipal.assertCurrent().getType();
PolicyLink l = assertLink(policyName, entry.getOrgName(), entry.getProjectName(), entry.getUserName(), entry.getUserDomain(), userType);
policyManager.link(l.policyId, l.orgId, l.projectId, l.userId);
auditLog.add(AuditObject.POLICY, AuditAction.UPDATE).field("policyId", l.policyId).field("name", policyName).field("link", l).field("action", "link").log();
return new GenericOperationResult(OperationResult.UPDATED);
}
use of com.walmartlabs.concord.server.GenericOperationResult in project concord by walmartlabs.
the class PolicyResource method delete.
@DELETE
@ApiOperation("Delete an existing policy")
@Path("/{policyName}")
@Produces(MediaType.APPLICATION_JSON)
public GenericOperationResult delete(@ApiParam @PathParam("policyName") @ConcordKey String policyName) {
assertAdmin();
UUID id = policyManager.getId(policyName);
if (id == null) {
throw new ConcordApplicationException("Policy not found: " + policyName, Status.NOT_FOUND);
}
policyManager.delete(id);
auditLog.add(AuditObject.POLICY, AuditAction.DELETE).field("policyId", id).field("name", policyName).log();
return new GenericOperationResult(OperationResult.DELETED);
}
use of com.walmartlabs.concord.server.GenericOperationResult in project concord by walmartlabs.
the class RepositoryResource method delete.
@DELETE
@ApiOperation("Delete an existing repository")
@Path("/{orgName}/project/{projectName}/repository/{repositoryName}")
@Produces(MediaType.APPLICATION_JSON)
public GenericOperationResult delete(@ApiParam @PathParam("orgName") @ConcordKey String orgName, @ApiParam @PathParam("projectName") @ConcordKey String projectName, @ApiParam @PathParam("repositoryName") @ConcordKey String repositoryName) {
OrganizationEntry org = orgManager.assertAccess(orgName, true);
UUID projectId = projectDao.getId(org.getId(), projectName);
if (projectId == null) {
throw new ConcordApplicationException("Project not found: " + projectName, Status.NOT_FOUND);
}
projectRepositoryManager.delete(projectId, repositoryName);
return new GenericOperationResult(OperationResult.DELETED);
}
Aggregations