use of cz.metacentrum.perun.audit.events.ExpirationNotifScheduler.GroupMembershipExpired in project perun by CESNET.
the class ExpirationNotifScheduler method auditOldGroupExpirations.
/**
* Logs expirations that happened a week ago for a group
*
* @param allowedStatuses allowed Statuses
* @param group group
* @throws InternalErrorException internal error
*/
private void auditOldGroupExpirations(List<Status> allowedStatuses, Group group) {
// log message for all members which expired 7 days ago
LocalDate expiredWeekAgo = getCurrentLocalDate().minusDays(7);
List<Member> expired7DaysAgo = perun.getSearcherBl().getMembersByGroupExpiration(sess, group, "=", expiredWeekAgo);
for (Member m : expired7DaysAgo) {
if (allowedStatuses.contains(m.getStatus())) {
MemberGroupStatus status = perun.getGroupsManagerBl().getDirectMemberGroupStatus(sess, m, group);
// we don't notify members in indirect only relation
if (status != null) {
if (didntSubmitGroupExtensionApplication(m, group)) {
// still didn't apply for extension
getPerun().getAuditer().log(sess, new GroupMembershipExpired(m, 7, group));
} else {
log.debug("{} not notified about expiration in {}, has submitted - pending application.", m, group);
}
} else {
log.debug("{} not notified about expiration in {}, isn't DIRECT member but still has expiration set!", m, group);
}
} else {
log.debug("{} not notified about expiration in {}, is not in VALID, SUSPENDED or EXPIRED state.", m, group);
}
}
}
Aggregations