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;
}
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);
}
}
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);
}
Aggregations