-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
131 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -255,6 +255,12 @@ const en = { | |
roleExpiryDate: "Role expiry date", | ||
roleExpiryDateQuestion: "Set a custom role expiration period", | ||
roleExpiryDateInfo: "This role will be removed from the user {{expiry}}", | ||
customInviterDisplayNameQuestion: "Set a custom inviter name", | ||
inviterDisplayName: "Custom inviter display name for invitations", | ||
inviterDisplayNamePlaceholder: "e.g. [email protected]", | ||
inviterDisplayNameError: "Custom inviter name is required, unless you use the default inviter name", | ||
customInviterDisplayNameInfoDefault: "Invitations for this role will show the name of the inviter as sender", | ||
customInviterDisplayNameInfo: "Invitations for this role will show a custom name / email as sender", | ||
expiryDateQuestion: "Set a custom invitation expiration period", | ||
expiryDateInfo: "Default an invitation is valid for 1 month", | ||
withinThreeMonths: "Within 1 month", | ||
|
@@ -403,6 +409,7 @@ const en = { | |
eduIDOnlyTooltip: "When checked the invitees will be required to log in with eduID", | ||
roleExpiryDateTooltip: "The end date of this role. After this date the role is removed from the user.", | ||
expiryDateTooltip: "The date on which this invitation expires", | ||
inviterDisplayName: "The functional address which will used in the invitations of the role.<br><br>Default the name of the inviter is show.", | ||
rolesTooltip: "Select all the roles that the invitee will be granted after accepting the invitation", | ||
intendedAuthorityTooltip: "The authority determines the rights the invitee will be granted on accepting the invitation", | ||
inviteesTooltip: "Add email addresses separated by comma, space or semi-colon or on seperate lines. You can also paste a csv file with line-separated email addresses.", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -254,6 +254,12 @@ const nl = { | |
roleExpiryDate: "Verloopdatum rol", | ||
roleExpiryDateQuestion: "Zet een specifieke verloopdatum voor de rol", | ||
roleExpiryDateInfo: "Deze rol wordt verwijderd van de gebruiker {{expiry}}", | ||
customInviterDisplayNameQuestion: "Zet een specifieke naam voor de uitnodiger", | ||
inviterDisplayName: "Specifieke naam uitnodiger voor in de uitnodiging", | ||
inviterDisplayNamePlaceholder: "Bijv. [email protected]", | ||
inviterDisplayNameError: "Specifieke naam uitnodiger is verplicht, tenzij je ervoor kiest om de default uitnodiger naam te gebruiken", | ||
customInviterDisplayNameInfoDefault: "Uitnodigingen voor deze rol zullen de naam van de uitnodiger tonen.", | ||
customInviterDisplayNameInfo: "Uitnodigingen voor deze rol zullen deze specifieke uitnodiger naam tonen.", | ||
expiryDateQuestion: "Zet een specifieke verloopdatum voor de uitnodiging", | ||
expiryDateInfo: "Standaard verloopt een uitnodiging na 1 maand", | ||
withinThreeMonths: "Binnen 1 maand", | ||
|
@@ -402,6 +408,7 @@ const nl = { | |
eduIDOnlyTooltip: "Indien ingeschakeld moeten de genodigden eduID gebruiken om in te loggen bij het accepteren", | ||
roleExpiryDateTooltip: "De einddatum van deze rol. Na deze datum wordt de rol verwijderd bij de gebruiker.", | ||
expiryDateTooltip: "De datum waarop deze uitnodiging verloopt", | ||
inviterDisplayName: "De specifieke naam van de uitnodiger zal worden getoond in de uitnodiging.<br><br>Standaard tonen we de naam van de daadwerkelijke uitnodiger.", | ||
rolesTooltip: "Alle rollen die de genodigden verkrijgen na het accepteren van de uitnodiging", | ||
intendedAuthorityTooltip: "De autoriteit geeft de rechten aan die de genodigde verwerft na het accepteren van de uitnodiging", | ||
inviteesTooltip: "Geef e-mailadressen op, gescheiden door komma, spatie of puntkomma, of op een eigen regel. Je kunt ook een csv-bestand plakken met daarin op elke regel een e-mailadres.", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
server/src/main/resources/db/mysql/migration/V37_0__role_remote_user.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE `roles` | ||
add `inviter_display_name` varchar(255) DEFAULT NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -578,10 +578,13 @@ public void doSeed() { | |
Role wiki = | ||
new Role("Wiki", "Wiki desc", | ||
application("1", EntityType.SAML20_SP), 365, false, false); | ||
wiki.setInviterDisplayName("[email protected]"); | ||
|
||
Role network = | ||
new Role("Network", "Network desc", | ||
application("2", EntityType.SAML20_SP), 365, false, false); | ||
|
||
|
||
Set<Application> applications = Set.of( | ||
new Application("3", EntityType.SAML20_SP), | ||
new Application("6", EntityType.OIDC10_RP)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,20 @@ | |
|
||
import access.AbstractMailTest; | ||
import access.AccessCookieFilter; | ||
import access.mail.MimeMessageParser; | ||
import access.manage.EntityType; | ||
import access.model.Authority; | ||
import access.model.Invitation; | ||
import access.model.*; | ||
import io.restassured.common.mapper.TypeRef; | ||
import io.restassured.http.ContentType; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.Instant; | ||
import java.time.temporal.ChronoUnit; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
class InvitationMailControllerTest extends AbstractMailTest { | ||
|
@@ -33,4 +40,47 @@ void resendInviteMail() throws Exception { | |
assertTrue(htmlContent.contains("SURF bv")); | ||
assertTrue(htmlContent.contains("Mail")); | ||
} | ||
|
||
@Test | ||
void newInvitationCustomDisplayName() throws Exception { | ||
//Because the user is changed and provisionings are queried | ||
stubForManageProvisioning(List.of()); | ||
AccessCookieFilter accessCookieFilter = openIDConnectFlow("/api/v1/users/login", MANAGE_SUB); | ||
|
||
stubForManageProviderById(EntityType.SAML20_SP, "1"); | ||
//Wiki role, see AbstractTest#seed | ||
List<Role> roles = roleRepository.findByApplicationUsagesApplicationManageId("1"); | ||
List<Long> roleIdentifiers = roles.stream() | ||
.map(Role::getId) | ||
.toList(); | ||
InvitationRequest invitationRequest = new InvitationRequest( | ||
Authority.GUEST, | ||
"Message", | ||
Language.en, | ||
true, | ||
false, | ||
false, | ||
false, | ||
List.of("[email protected]"), | ||
roleIdentifiers, | ||
Instant.now().plus(365, ChronoUnit.DAYS), | ||
Instant.now().plus(12, ChronoUnit.DAYS)); | ||
|
||
given() | ||
.when() | ||
.filter(accessCookieFilter.cookieFilter()) | ||
.accept(ContentType.JSON) | ||
.header(accessCookieFilter.csrfToken().getHeaderName(), accessCookieFilter.csrfToken().getToken()) | ||
.contentType(ContentType.JSON) | ||
.body(invitationRequest) | ||
.post("/api/v1/invitations") | ||
.then() | ||
.statusCode(201); | ||
|
||
List<MimeMessageParser> mimeMessageParsers = super.allMailMessages(1); | ||
String htmlContent = mimeMessageParsers.getFirst().getHtmlContent(); | ||
|
||
assertTrue(htmlContent.contains("[email protected]")); | ||
} | ||
|
||
} |