Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INDIGO IAM v1.10.3 release #899

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove Institute label
The 64 char limit on label val is not enough to store Institute.
  • Loading branch information
enricovianello committed Dec 19, 2024
commit 59725c726cab9e271e16e241b2e389feb8fe897d
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
Loading