Commit c6f67b17 authored by michael.simon's avatar michael.simon
Browse files

Only deregister users, if IDP AttributeQuery status is good

parent e31f0723
......@@ -64,4 +64,7 @@ public interface RegistryDao extends BaseDao<RegistryEntity, Long> {
List<RegistryEntity> findByServiceAndNotStatus(ServiceEntity service,
RegistryStatus... status);
List<RegistryEntity> findByServiceAndStatusAndIDPGood(String serviceShortName, RegistryStatus status, Date date,
int limit);
}
......@@ -31,6 +31,7 @@ import edu.kit.scc.webreg.dao.RegistryDao;
import edu.kit.scc.webreg.entity.RegistryEntity;
import edu.kit.scc.webreg.entity.RegistryEntity_;
import edu.kit.scc.webreg.entity.RegistryStatus;
import edu.kit.scc.webreg.entity.SamlIdpMetadataEntityStatus;
import edu.kit.scc.webreg.entity.ServiceEntity;
import edu.kit.scc.webreg.entity.ServiceEntity_;
import edu.kit.scc.webreg.entity.UserEntity;
......@@ -91,6 +92,17 @@ public class JpaRegistryDao extends JpaBaseDao<RegistryEntity, Long> implements
.setMaxResults(limit).getResultList();
}
@SuppressWarnings("unchecked")
@Override
public List<RegistryEntity> findByServiceAndStatusAndIDPGood(String serviceShortName, RegistryStatus status, Date date, int limit) {
return em.createQuery("select r from RegistryEntity r where r.service.shortName = :ssn and r.registryStatus = :status"
+ " and lastStatusChange < :is and r.user.idp.aqIdpStatus = :aqStatus order by lastStatusChange asc")
.setParameter("ssn", serviceShortName).setParameter("status", status)
.setParameter("is", date)
.setParameter("aqStatus", SamlIdpMetadataEntityStatus.GOOD)
.setMaxResults(limit).getResultList();
}
@SuppressWarnings("unchecked")
@Override
public List<RegistryEntity> findRegistriesForDepro(String serviceShortName) {
......
......@@ -70,7 +70,7 @@ public class DeregisterLostAccessRegistries extends AbstractExecutableJob {
UserService userService = (UserService) ic.lookup("global/bwreg/bwreg-service/UserServiceImpl!edu.kit.scc.webreg.service.UserService");
KnowledgeSessionService knowledgeSessionService = (KnowledgeSessionService) ic.lookup("global/bwreg/bwreg-service/KnowledgeSessionServiceImpl!edu.kit.scc.webreg.drools.KnowledgeSessionService");
List<RegistryEntity> registryList = registryService.findByServiceAndStatus(ssn, RegistryStatus.LOST_ACCESS,
List<RegistryEntity> registryList = registryService.findByServiceAndStatusAndIDPGood(ssn, RegistryStatus.LOST_ACCESS,
new Date(System.currentTimeMillis() - lastUpdate), limit);
if (registryList.size() == 0)
......
......@@ -61,4 +61,7 @@ public interface RegistryService extends BaseService<RegistryEntity, Long> {
List<RegistryEntity> findByServiceAndNotStatus(ServiceEntity service,
RegistryStatus... status);
List<RegistryEntity> findByServiceAndStatusAndIDPGood(String serviceShortName, RegistryStatus status, Date date,
int limit);
}
......@@ -49,6 +49,11 @@ public class RegistryServiceImpl extends BaseServiceImpl<RegistryEntity, Long> i
return dao.findByServiceAndStatus(serviceShortName, status, date, limit);
}
@Override
public List<RegistryEntity> findByServiceAndStatusAndIDPGood(String serviceShortName, RegistryStatus status, Date date, int limit) {
return dao.findByServiceAndStatusAndIDPGood(serviceShortName, status, date, limit);
}
@Override
public List<RegistryEntity> findRegistriesForDepro(String serviceShortName) {
return dao.findRegistriesForDepro(serviceShortName);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment