Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,17 @@ private static void processInjector(ResteasyDeployment deployment, Injector inje

var providerFactory = deployment.getProviderFactory();
for (var binding : injector.getBindings().values()) {
var type = (Object) binding.getKey().getTypeLiteral().getRawType();
if (type instanceof Class<?> beanClass) {
if (GetRestful.isRootResource(beanClass)) {
rootResourceBindings.add(binding);
}
if (beanClass.isAnnotationPresent(Provider.class)) {
log.info("registering provider instance for {}", beanClass.getName());
providerFactory.registerProviderInstance(binding.getProvider().get());
}
var type = binding.getKey().getTypeLiteral().getRawType();
if (type == null) {
continue;
}

if (GetRestful.isRootResource(type)) {
rootResourceBindings.add(binding);
}
if (type.isAnnotationPresent(Provider.class)) {
log.info("registering provider instance for {}", type.getName());
providerFactory.registerProviderInstance(binding.getProvider().get());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,26 +368,24 @@ public void update(UUID orgId, String secretName, SecretUpdateParams params) {
newEncryptedData = null;
hashAlgorithm = null;
}
if(newProjectIds == null || newProjectIds.isEmpty()){
if (newProjectIds == null || newProjectIds.isEmpty()) {
policyManager.checkEntity(e.getOrgId(), null, EntityType.SECRET, EntityAction.UPDATE, newOwner,
PolicyUtils.secretToMap(e.getOrgId(), e.getName(), e.getType(), e.getVisibility(), e.getStoreType()));
} else {
newProjectIds.stream().forEach(newProjectId -> {
policyManager.checkEntity(e.getOrgId(), newProjectId, EntityType.SECRET, EntityAction.UPDATE, newOwner,
PolicyUtils.secretToMap(e.getOrgId(), e.getName(), e.getType(), e.getVisibility(), e.getStoreType()));
});
newProjectIds.forEach(newProjectId ->
policyManager.checkEntity(e.getOrgId(), newProjectId, EntityType.SECRET, EntityAction.UPDATE, newOwner,
PolicyUtils.secretToMap(e.getOrgId(), e.getName(), e.getType(), e.getVisibility(), e.getStoreType())));
}

String newName = validateName(params.newName(), newOrgId, e);

SecretType finalNewType = newType;
secretDao.tx(tx -> {
if (newOrgId != null) {
// update repository mapping to null when org is changing
repositoryDao.clearSecretMappingBySecretId(tx, e.getId());
}

secretDao.update(tx, e.getId(), params.newName(), newOwner != null ? newOwner.getId() : null,
secretDao.update(tx, e.getId(), newName, newOwner != null ? newOwner.getId() : null,
finalNewType, newEncryptedData, params.newVisibility(), newOrgId, hashAlgorithm);
secretDao.updateSecretProjects(tx, e.getId(), params.removeProjectLink() ? Collections.emptySet() : newProjectIds);
});
Expand Down