Search in sources :

Example 1 with SecretEntry

use of com.walmartlabs.concord.server.org.secret.SecretEntry in project concord by walmartlabs.

the class AuditLogResource method getEffectiveSecretId.

private UUID getEffectiveSecretId(UUID effectiveOrgId, Map<String, String> details) {
    UUID secretId = getUUID(details, "secretId");
    String secretName = details.get("secretName");
    if (effectiveOrgId == null && secretId == null && secretName != null) {
        throw new ValidationErrorsException("'orgId' or 'orgName' is required");
    }
    if (secretId != null || secretName != null) {
        SecretEntry secret = secretManager.assertAccess(effectiveOrgId, secretId, secretName, ResourceAccessLevel.READER, true);
        return secret.getId();
    }
    return null;
}
Also used : SecretEntry(com.walmartlabs.concord.server.org.secret.SecretEntry) UUID(java.util.UUID) ValidationErrorsException(org.sonatype.siesta.ValidationErrorsException)

Example 2 with SecretEntry

use of com.walmartlabs.concord.server.org.secret.SecretEntry in project concord by walmartlabs.

the class ProjectRepositoryManager method insert.

public void insert(DSLContext tx, UUID orgId, String orgName, UUID projectId, String projectName, RepositoryEntry entry, boolean doAuditLog) {
    RepositoryUtils.assertRepository(entry);
    SecretEntry secret = assertSecret(orgId, entry);
    policyManager.checkEntity(orgId, projectId, EntityType.REPOSITORY, EntityAction.CREATE, null, PolicyUtils.repositoryToMap(orgId, orgName, projectId, projectName, entry, secret));
    UUID repoId = repositoryDao.insert(tx, projectId, entry.getName(), entry.getUrl(), trim(entry.getBranch()), trim(entry.getCommitId()), trim(entry.getPath()), secret == null ? null : secret.getId(), entry.isDisabled(), entry.getMeta(), entry.isTriggersDisabled());
    Map<String, Object> ev = Events.Repository.repositoryCreated(projectId, repoId, entry.getName(), !entry.isDisabled());
    externalEventResource.event(Events.CONCORD_EVENT, ev);
    if (doAuditLog) {
        RepositoryEntry newEntry = repositoryDao.get(tx, projectId, repoId);
        addAuditLog(orgId, orgName, projectId, projectName, null, newEntry);
    }
}
Also used : SecretEntry(com.walmartlabs.concord.server.org.secret.SecretEntry) AuditObject(com.walmartlabs.concord.server.audit.AuditObject) UUID(java.util.UUID)

Example 3 with SecretEntry

use of com.walmartlabs.concord.server.org.secret.SecretEntry in project concord by walmartlabs.

the class ProjectRepositoryManager method update.

private void update(DSLContext tx, UUID orgId, String orgName, UUID projectId, String projectName, UUID repoId, RepositoryEntry entry) {
    RepositoryUtils.assertRepository(entry);
    RepositoryEntry prevEntry = repositoryDao.get(tx, projectId, repoId);
    SecretEntry secret = assertSecret(orgId, entry);
    policyManager.checkEntity(orgId, projectId, EntityType.REPOSITORY, EntityAction.UPDATE, null, PolicyUtils.repositoryToMap(orgId, orgName, projectId, projectName, entry, secret));
    repositoryDao.update(tx, repoId, entry.getName(), entry.getUrl(), trim(entry.getBranch()), trim(entry.getCommitId()), trim(entry.getPath()), secret == null ? null : secret.getId(), entry.isDisabled(), entry.isTriggersDisabled());
    Map<String, Object> ev = Events.Repository.repositoryUpdated(projectId, repoId, entry.getName(), !entry.isDisabled());
    externalEventResource.event(Events.CONCORD_EVENT, ev);
    RepositoryEntry newEntry = repositoryDao.get(tx, projectId, repoId);
    addAuditLog(orgId, orgName, projectId, projectName, prevEntry, newEntry);
}
Also used : SecretEntry(com.walmartlabs.concord.server.org.secret.SecretEntry) AuditObject(com.walmartlabs.concord.server.audit.AuditObject)

Aggregations

SecretEntry (com.walmartlabs.concord.server.org.secret.SecretEntry)3 AuditObject (com.walmartlabs.concord.server.audit.AuditObject)2 UUID (java.util.UUID)2 ValidationErrorsException (org.sonatype.siesta.ValidationErrorsException)1