use of nl.knaw.huygens.timbuctoo.v5.security.dto.User in project timbuctoo by HuygensING.
the class BasicPermissionFetcherTest method initializeOwnerAuthorizationThrowsExceptionWhenVreAuthorizationCrudFails.
@Test(expected = AuthorizationCreationException.class)
public void initializeOwnerAuthorizationThrowsExceptionWhenVreAuthorizationCrudFails() throws Exception {
User user = userWithId("testuserid");
doThrow(AuthorizationCreationException.class).when(vreAuthorizationCrud).createAuthorization("testownerid__testdatasetid", user, "ADMIN");
permissionFetcher.initializeOwnerAuthorization(user, "testownerid", "testdatasetid");
}
use of nl.knaw.huygens.timbuctoo.v5.security.dto.User in project timbuctoo by HuygensING.
the class BasicPermissionFetcherTest method initializeOwnerAuthorizationCreatesAdminAuthorization.
@Test
public void initializeOwnerAuthorizationCreatesAdminAuthorization() throws Exception {
User user = userWithId("testuserid");
permissionFetcher.initializeOwnerAuthorization(user, "testownerid", "testdatasetid");
verify(vreAuthorizationCrud).createAuthorization("testownerid__testdatasetid", user, "ADMIN");
}
use of nl.knaw.huygens.timbuctoo.v5.security.dto.User in project timbuctoo by HuygensING.
the class JsonBasedUserStoreTest method createUserLetsTheUserBeCreatedOnlyOnce.
@Test
public void createUserLetsTheUserBeCreatedOnlyOnce() throws Exception {
User user1 = instance.createUser("pid", "email", "givenName", "surname", "organization");
User user2 = instance.createUser("pid", "email", "givenName", "surname", "organization");
assertThat(user1.getId(), is(user2.getId()));
}
use of nl.knaw.huygens.timbuctoo.v5.security.dto.User in project timbuctoo by HuygensING.
the class JsonBasedUserStoreTest method setUp.
@Before
public void setUp() throws Exception {
usersFile = FileHelpers.makeTempFilePath(false);
User user = User.create("", "pidOfKnownUser");
User userWithoutPid = User.create(null, null);
User[] users = { user, userWithoutPid };
OBJECT_MAPPER.writeValue(usersFile.toFile(), users);
instance = forFile(usersFile);
}
use of nl.knaw.huygens.timbuctoo.v5.security.dto.User in project timbuctoo by HuygensING.
the class JsonBasedUserStoreTest method createUserAddsAUserToTheUsersFile.
@Test
public void createUserAddsAUserToTheUsersFile() throws Exception {
User createdUser = instance.createUser("pidOfOtherUser", "email", "givenName", "surname", "organization");
Optional<User> user = instance.userForId(createdUser.getId());
assertThat(user, is(present()));
assertThat(user.get().getPersistentId(), is("pidOfOtherUser"));
}
Aggregations