PMD fix #44

Merged
timo.bejan.ext merged 1 commits from RED-7094 into master 2023-07-06 15:34:29 +02:00

View File

@ -25,20 +25,17 @@ public class SyncUserPermissionsJob implements Job {
@Override @Override
public void execute(JobExecutionContext context) throws JobExecutionException { public void execute(JobExecutionContext context) {
var singleTenant = context.getJobDetail().getJobDataMap() != null ? context.getJobDetail().getJobDataMap().get("tenantId") : null; var singleTenant = context.getJobDetail().getJobDataMap() != null ? context.getJobDetail().getJobDataMap().get("tenantId") : null;
tenantProvider.getTenants().forEach(tenant -> { tenantProvider.getTenants().forEach(tenant -> {
if(isTenantReadyForPersistence(tenant)) {
// if it's for a single tenant run only for that one, else run it for all tenants // if it's for a single tenant run only for that one, else run it for all tenants
if (tenant.getTenantId().equals(singleTenant) || singleTenant == null) { if (isTenantReadyForPersistence(tenant) && (tenant.getTenantId().equals(singleTenant) || singleTenant == null)) {
TenantContext.setTenantId(tenant.getTenantId()); TenantContext.setTenantId(tenant.getTenantId());
customPermissionService.syncAllCustomPermissions(); customPermissionService.syncAllCustomPermissions();
TenantContext.clear(); TenantContext.clear();
} }
}
}); });
} }
} }