@Override public String serializeToString() { return this.getClass().getSimpleName() + ":[" + "id=<" + getId() + ">" + ", userId=<" + getUserId() + ">" + ", voId=<" + getVoId() + ">" + ", status=<" + (getStatus() == null ? "\\0" : BeansUtils.createEscaping(getStatus().toString())) + ">" + ", type=<" + (getMembershipType() == null ? "\\0" : BeansUtils.createEscaping(getMembershipType().toString())) + ">" + ", sourceGroupId=<" + (getSourceGroupId() == null ? "\\0" : getSourceGroupId().toString()) + ">" + ", sponsored=<" + sponsored + ">" + ']'; }
/** * Logs expirations that happened a week ago * * @param allowedStatuses allowed Statuses * @param vosMap vos * @throws InternalErrorException internal error */ private void auditOldExpirations(List<Status> allowedStatuses, Map<Integer, Vo> vosMap) throws InternalErrorException { // log message for all members which expired 7 days ago Calendar expiredWeekAgo = Calendar.getInstance(); expiredWeekAgo.add(Calendar.DAY_OF_MONTH, -7); List<Member> expired7DaysAgo = perun.getSearcherBl().getMembersByExpiration(sess, "=", expiredWeekAgo); // include expired in this case allowedStatuses.add(Status.EXPIRED); for (Member m : expired7DaysAgo) { if (allowedStatuses.contains(m.getStatus())) { if (didntSubmitExtensionApplication(m)) { // still didn't apply for extension getPerun().getAuditer().log(sess, new MembershipExpired(m, 7, vosMap.get(m.getVoId()))); } else { log.debug("{} not notified about expiration, has submitted - pending application.", m); } } else { log.debug("{} not notified about expiration, is not in VALID, SUSPENDED or EXPIRED state.", m); } } }
/** * Expires members whose expiration is set to given date or before it. * * @throws InternalErrorException internal error * @throws WrongAttributeAssignmentException error * @throws AttributeNotExistsException error */ private void expireMembers(Calendar date) throws InternalErrorException, WrongAttributeAssignmentException, AttributeNotExistsException { List<Member> shouldBeExpired = perun.getSearcherBl().getMembersByExpiration(sess, "<=", date); for (Member member : shouldBeExpired) { if (member.getStatus().equals(Status.VALID)) { try { perun.getMembersManagerBl().expireMember(sess, member); log.info("Switching {} to EXPIRE state, due to expiration {}.", member, perun.getAttributesManagerBl().getAttribute(sess, member, "urn:perun:member:attribute-def:def:membershipExpiration").getValue()); } catch (MemberNotValidYetException e) { log.error("Consistency error while trying to expire member {}, exception {}", member, e); } } } }
/** * Validates member whose expiration is set after the given date * * @param date date * @throws InternalErrorException internal error * @throws WrongAttributeAssignmentException error * @throws AttributeNotExistsException error */ private void validateMembers(Calendar date) throws InternalErrorException, WrongAttributeAssignmentException, AttributeNotExistsException { List<Member> shouldntBeExpired = perun.getSearcherBl().getMembersByExpiration(sess, ">", date); for (Member member : shouldntBeExpired) { if (member.getStatus().equals(Status.EXPIRED)) { try { perun.getMembersManagerBl().validateMember(sess, member); log.info("Switching {} to VALID state, due to changed expiration {}.", member, perun.getAttributesManagerBl().getAttribute(sess, member, "urn:perun:member:attribute-def:def:membershipExpiration").getValue()); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException e) { log.error("Error during validating member {}, exception {}", member, e); } } } }
for (Member m : expireInTime) { try { if (allowedStatuses.contains(m.getStatus())) { perun.getMembersManagerBl().canExtendMembershipWithReason(sess, m); if (didntSubmitExtensionApplication(m)) {
members = perun.getMembersManagerBl().getMembersByUser(perunSession, user); for(Member member: members) { if(member.getStatus().equals(Status.VALID)) { membersOfPerunVo.add("memberOfPerunVo: " + member.getVoId()); List<Group> groups;
if(this.member.getStatus().equals(Status.VALID)) { Matcher addedTo = addedToPattern.matcher(msg);
if (!Arrays.asList(Status.VALID, Status.INVALID).contains(member.getStatus())) { throw new CantBeApprovedException("Application of member with membership status: "+member.getStatus()+" can't be approved. Please wait until member extends/re-validate own membership in a VO."); if (!Arrays.asList(Status.VALID, Status.INVALID).contains(member.getStatus())) { throw new CantBeApprovedException("Application of member with membership status: "+member.getStatus()+" can't be approved. Please wait until member extends/re-validate own membership in a VO.");
public RichMember(User user, Member member, List<UserExtSource> userExtSources) { super(member.getId(), member.getUserId(), member.getVoId(), member.getStatus(), member.getCreatedAt(), member.getCreatedBy(), member.getModifiedAt(), member.getModifiedBy(), member.getCreatedByUid(), member.getModifiedByUid()); setMembershipType(member.getMembershipType()); setSponsored(member.isSponsored()); this.setGroupsStatuses(member.getGroupStatuses()); this.user = user; this.userExtSources = userExtSources; this.userAttributes = null; this.memberAttributes = null; }