Skip to content

Commit

Permalink
Remove Institute label
Browse files Browse the repository at this point in the history
The 64 char limit on label val is not enough to store Institute.
  • Loading branch information
enricovianello committed Dec 19, 2024
1 parent 5312234 commit 59725c7
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

import it.infn.mw.iam.api.registration.cern.CernHrDBApiService;
import it.infn.mw.iam.api.registration.cern.CernHrDbApiError;
import it.infn.mw.iam.api.registration.cern.dto.InstituteDTO;
import it.infn.mw.iam.api.registration.cern.dto.ParticipationDTO;
import it.infn.mw.iam.api.registration.cern.dto.VOPersonDTO;
import it.infn.mw.iam.api.scim.exception.IllegalArgumentException;
Expand Down Expand Up @@ -129,7 +128,6 @@ public void handleAccount(String cernPersonId, String experiment, IamAccount a)
return;
}

syncInstitute(a, ep.get().getInstitute());
syncAccountEndTime(a, ep.get().getEndDate());
setCernStatusLabel(a, CernStatus.VO_MEMBER, format(SYNCHRONIZED_MESSAGE));

Expand Down Expand Up @@ -244,11 +242,6 @@ private void restoreAccount(IamAccount a) {
accountService.deleteLabel(a, statusLabel);
}

private void syncInstitute(IamAccount a, InstituteDTO institute) {
IamLabel instituteLabel = CernHrLifecycleUtils.buildInstituteLabel(institute);
accountService.addLabel(a, instituteLabel);
}

private void syncAccountEndTime(IamAccount a, Date endDate) {
if (!isSkipEndDateSynch(a)) {
accountService.setAccountEndTime(a, endDate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import org.joda.time.DateTimeComparator;

import it.infn.mw.iam.api.registration.cern.dto.InstituteDTO;
import it.infn.mw.iam.api.registration.cern.dto.ParticipationDTO;
import it.infn.mw.iam.core.lifecycle.ExpiredAccountsHandler;
import it.infn.mw.iam.core.lifecycle.ExpiredAccountsHandler.AccountLifecycleStatus;
Expand All @@ -45,7 +44,6 @@ public class CernHrLifecycleUtils {
public static final String LABEL_IGNORE = "ignore";
public static final String LABEL_SKIP_EMAIL_SYNCH = "skip-email-synch";
public static final String LABEL_SKIP_END_DATE_SYNCH = "skip-end-date-synch";
public static final String LABEL_INSTITUTE = "institute";

private CernHrLifecycleUtils() {}

Expand Down Expand Up @@ -109,13 +107,4 @@ public static boolean isActiveMembership(Date endTime) {
public static boolean isAccountIgnored(IamAccount a) {
return a.hasLabel(buildCernIgnoreLabel());
}

public static IamLabel buildInstituteLabel(InstituteDTO i) {
String fullInstitute = String.format("%s, %s, %s", i.getName(), i.getTown(), i.getCountry());
return IamLabel.builder()
.prefix(LABEL_CERN_PREFIX)
.name(LABEL_INSTITUTE)
.value(fullInstitute)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import static it.infn.mw.iam.core.lifecycle.cern.CernHrLifecycleHandler.SYNCHRONIZED_MESSAGE;
import static it.infn.mw.iam.core.lifecycle.cern.CernHrLifecycleHandler.CernStatus.IGNORED;
import static it.infn.mw.iam.core.lifecycle.cern.CernHrLifecycleUtils.LABEL_CERN_PREFIX;
import static it.infn.mw.iam.core.lifecycle.cern.CernHrLifecycleUtils.LABEL_INSTITUTE;
import static it.infn.mw.iam.core.lifecycle.cern.CernHrLifecycleUtils.LABEL_MESSAGE;
import static it.infn.mw.iam.core.lifecycle.cern.CernHrLifecycleUtils.LABEL_STATUS;
import static it.infn.mw.iam.core.lifecycle.cern.CernHrLifecycleUtils.LABEL_TIMESTAMP;
Expand Down Expand Up @@ -277,14 +276,6 @@ public void testLifecycleWorksForValidAccounts() {
Optional<IamLabel> cernTimestampLabel =
testAccount.getLabelByPrefixAndName(LABEL_CERN_PREFIX, LABEL_TIMESTAMP);
assertThat(cernTimestampLabel.isPresent(), is(false));

Optional<IamLabel> cernInstituteLabel =
testAccount.getLabelByPrefixAndName(LABEL_CERN_PREFIX, LABEL_INSTITUTE);
assertThat(cernInstituteLabel.isPresent(), is(true));
assertThat(cernInstituteLabel.get().getValue(),
is("Istituto Nazionale di Fisica Nucleare, Bologna, IT"));


}

@Test
Expand Down

0 comments on commit 59725c7

Please sign in to comment.