Skip to content

Commit

Permalink
Merge branch 'releases/3.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
fhanik committed Mar 8, 2016
2 parents 769e651 + 6ba26ec commit 616e8bc
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=3.2.0
version=3.2.1
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ <h2 th:text="${client_display_name}">Cloudbees</h2>
<th:block th:with="index=${iter.index},code=${scope.get('code')}">
<li class="undecided">
<input type="checkbox" checked="checked" name="scope.0" id="scope.0" th:name="|scope.${index}|" th:value="${code}" th:id="|scope.${index}|"/>
<label for="scope.0" th:for="|scope.${index}|" th:utext="${scope.get('text')}">Something new.</label>
<label for="scope.0" th:for="|scope.${index}|" th:text="${scope.get('text')}">Something new.</label>
</li>
</th:block>
</th:block>
<th:block th:each="scope, iter : ${approved_scopes}">
<th:block th:with="index=${iter.index + undecided_scopes.size()},code=${scope.get('code')}">
<li>
<input type="checkbox" checked="checked" name="scope.1" id="scope.1" th:name="|scope.${index}|" th:value="${code}" th:id="|scope.${index}|"/>
<label for="scope.1" th:for="|scope.${index}|" th:utext="${scope.get('text')}">Something already approved.</label>
<label for="scope.1" th:for="|scope.${index}|" th:text="${scope.get('text')}">Something already approved.</label>
</li>
</th:block>
</th:block>
<th:block th:each="scope, iter : ${denied_scopes}">
<th:block th:with="index=${iter.index + undecided_scopes.size() + approved_scopes.size()},code=${scope.get('code')}">
<li>
<input type="checkbox" name="scope.2" id="scope.2" th:name="|scope.${index}|" th:value="${code}" th:id="|scope.${index}|"/>
<label for="scope.2" th:for="|scope.${index}|" th:utext="${scope.get('text')}">Something previously denied.</label>
<label for="scope.2" th:for="|scope.${index}|" th:text="${scope.get('text')}">Something previously denied.</label>
</li>
</th:block>
</th:block>
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/resources/templates/web/approvals.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ <h3 th:text="${clientnames[client.key]}">
th:checked="${approval.status.toString() == 'APPROVED'}" />
<label for="scope.0"
th:for="|scope.${iter.index}|"
th:utext="${#messages.msgOrNull(code) ?: approval.description}">Something new.</label>
th:text="${#messages.msgOrNull(code) ?: approval.description}">Something new.</label>
</li>
</th:block>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,38 @@ public void testApprovingAnApp() throws Exception {
Assert.assertThat(webDriver.findElements(By.xpath("//input[@value='app-password.write']")), Matchers.empty());
}

@Test
public void testScopeDescriptions() throws Exception {
ResponseEntity<SearchResults<ScimGroup>> getGroups = restTemplate.exchange(baseUrl + "/Groups?filter=displayName eq '{displayName}'",
HttpMethod.GET,
null,
new ParameterizedTypeReference<SearchResults<ScimGroup>>() {
},
"cloud_controller.read");
ScimGroup group = getGroups.getBody().getResources().stream().findFirst().get();

group.setDescription("Read about <b>your</b> clouds.");
HttpHeaders headers = new HttpHeaders();
headers.add("If-Match", Integer.toString(group.getVersion()));
HttpEntity request = new HttpEntity(group, headers);
restTemplate.exchange(baseUrl + "/Groups/{group-id}", HttpMethod.PUT, request, Object.class, group.getId());

ScimUser user = createUnapprovedUser();

// Visit app
webDriver.get(appUrl);

// Sign in to login server
webDriver.findElement(By.name("username")).sendKeys(user.getUserName());
webDriver.findElement(By.name("password")).sendKeys(user.getPassword());
webDriver.findElement(By.xpath("//input[@value='Sign in']")).click();

// Authorize the app for some scopes
Assert.assertEquals("Application Authorization", webDriver.findElement(By.cssSelector("h1")).getText());

webDriver.findElement(By.xpath("//label[text()='Read about <b>your</b> clouds.']/preceding-sibling::input"));
}

@Test
public void testInvalidAppRedirectDisplaysError() throws Exception {
ScimUser user = createUnapprovedUser();
Expand Down

0 comments on commit 616e8bc

Please sign in to comment.