User resource: No longer check for admin role.

In SCMM v2 we use permissions. The checks are already implemented in
DefaultUserManager called by the resource.

When not authorized, the check results in an AuthorizationException,
which is mapped to 403.
As this is no longer realized in the resource, the corresponding test
is removed.
This commit is contained in:
Johannes Schnatterer
2018-06-21 14:50:55 +02:00
parent ab290a78d9
commit b95066946e
2 changed files with 3 additions and 27 deletions

View File

@@ -93,7 +93,6 @@ public class UserRootResourceTest {
dispatcher.invoke(request, response);
assertEquals(HttpServletResponse.SC_OK, response.getStatus());
System.out.println(response.getContentAsString());
assertTrue(response.getContentAsString().contains("\"name\":\"Neo\""));
assertTrue(response.getContentAsString().contains("\"password\":\"__dummypassword__\""));
assertTrue(response.getContentAsString().contains("\"self\":{\"href\":\"/v2/users/Neo\"}"));
@@ -115,17 +114,6 @@ public class UserRootResourceTest {
assertFalse(response.getContentAsString().contains("\"delete\":{\"href\":\"/v2/users/Neo\"}"));
}
@Test
@SubjectAware(username = "unpriv")
public void shouldNotGetSingleUserForSimpleUser() throws URISyntaxException {
MockHttpRequest request = MockHttpRequest.get("/" + UserRootResource.USERS_PATH_V2 + "Neo");
MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response);
assertEquals(HttpServletResponse.SC_FORBIDDEN, response.getStatus());
}
@Test
public void shouldCreateNewUserWithEncryptedPassword() throws URISyntaxException, IOException {
URL url = Resources.getResource("sonia/scm/api/v2/user-test-create.json");