126 changes: 110 additions & 16 deletions src/main/java/alfio/manager/user/UserManager.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ public void ensureConfiguration() {
this.username = UUID.randomUUID().toString();

var organizationModification = new OrganizationModification(null, organizationName, "email@example.com", "org", null, null);
userManager.createOrganization(organizationModification);
userManager.createOrganization(organizationModification, null);
this.organization = organizationRepository.findByName(organizationName).orElseThrow();
userManager.insertUser(organization.getId(), username, "test", "test", "test@example.com", Role.API_CONSUMER, User.Type.INTERNAL);
userManager.insertUser(organization.getId(), username, "test", "test", "test@example.com", Role.API_CONSUMER, User.Type.INTERNAL, null);

this.mockPrincipal = Mockito.mock(Principal.class);
Mockito.when(mockPrincipal.getName()).thenReturn(username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void setUp() {
Pair<Event, String> eventAndUser = initEvent(categories, organizationRepository, userManager, eventManager, eventRepository);
event = eventAndUser.getLeft();
username = UUID.randomUUID().toString();
userManager.insertUser(event.getOrganizationId(), username, "test", "test", "test@example.com", Role.API_CONSUMER, User.Type.INTERNAL);
userManager.insertUser(event.getOrganizationId(), username, "test", "test", "test@example.com", Role.API_CONSUMER, User.Type.INTERNAL, null);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ public void ensureConfiguration() {
this.username = UUID.randomUUID().toString();

var organizationModification = new OrganizationModification(null, organizationName, "email@example.com", "org", null, null);
userManager.createOrganization(organizationModification);
userManager.createOrganization(organizationModification, null);
var organization = organizationRepository.findByName(organizationName).orElseThrow();
userManager.insertUser(organization.getId(), username, "test", "test", "test@example.com", Role.API_CONSUMER, User.Type.INTERNAL);
userManager.insertUser(organization.getId(), username, "test", "test", "test@example.com", Role.API_CONSUMER, User.Type.INTERNAL, null);

this.principal = Mockito.mock(Principal.class);
Mockito.when(principal.getName()).thenReturn(username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void prepareEnv() {
organizationRepository.create("org", "org", "email@example.com", null, null);
Organization organization = organizationRepository.findByName("org").orElseThrow();

userManager.insertUser(organization.getId(), USERNAME, "test", "test", "test@example.com", Role.OWNER, User.Type.INTERNAL);
userManager.insertUser(organization.getId(), USERNAME, "test", "test", "test@example.com", Role.OWNER, User.Type.INTERNAL, null);

Map<String, String> desc = new HashMap<>();
desc.put("en", "muh description");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private Pair<Event,String> initEvent(List<TicketCategoryModification> categories

organizationRepository.create(organizationName, "org", "email@example.com", null, null);
Organization organization = organizationRepository.findByName(organizationName).get();
userManager.insertUser(organization.getId(), username, "test", "test", "test@example.com", Role.OPERATOR, User.Type.INTERNAL);
userManager.insertUser(organization.getId(), username, "test", "test", "test@example.com", Role.OPERATOR, User.Type.INTERNAL, null);

Map<String, String> desc = new HashMap<>();
desc.put("en", "muh description");
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/alfio/test/util/IntegrationTestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ public static Pair<Event, String> initEvent(List<TicketCategoryModification> cat
String eventName = UUID.randomUUID().toString();

var organizationModification = new OrganizationModification(null, organizationName, "email@example.com", "org", null, null);
userManager.createOrganization(organizationModification);
userManager.createOrganization(organizationModification, null);
Organization organization = organizationRepository.findByName(organizationName).orElseThrow();
userManager.insertUser(organization.getId(), username, "test", "test", "test@example.com", Role.OPERATOR, User.Type.INTERNAL);
userManager.insertUser(organization.getId(), username+"_owner", "test", "test", "test@example.com", Role.OWNER, User.Type.INTERNAL);
userManager.insertUser(organization.getId(), username, "test", "test", "test@example.com", Role.OPERATOR, User.Type.INTERNAL, null);
userManager.insertUser(organization.getId(), username+"_owner", "test", "test", "test@example.com", Role.OWNER, User.Type.INTERNAL, null);

LocalDateTime expiration = LocalDateTime.now(ClockProvider.clock()).plusDays(5).plusHours(1);

Expand Down