use of nl.knaw.huygens.timbuctoo.security.dto.VreAuthorization in project timbuctoo by HuygensING.
the class VreAuthorizationTest method hasAdminAccessReturnsFalseIfTheRolesContainUnverifiedUserAndAdmin.
@Test
public void hasAdminAccessReturnsFalseIfTheRolesContainUnverifiedUserAndAdmin() throws Exception {
VreAuthorization instance = VreAuthorization.create("", "", UNVERIFIED_USER_ROLE, USER_ROLE);
boolean allowedToWrite = instance.hasAdminAccess();
assertThat(allowedToWrite, is(false));
}
use of nl.knaw.huygens.timbuctoo.security.dto.VreAuthorization in project timbuctoo by HuygensING.
the class VreAuthorizationTest method isAllowedToWriteReturnsTrueIfTheRolesContainAdmin.
@Test
public void isAllowedToWriteReturnsTrueIfTheRolesContainAdmin() throws Exception {
VreAuthorization instance = VreAuthorization.create("", "", ADMIN_ROLE);
boolean allowedToWrite = instance.isAllowedToWrite();
assertThat(allowedToWrite, is(true));
}
use of nl.knaw.huygens.timbuctoo.security.dto.VreAuthorization in project timbuctoo by HuygensING.
the class VreAuthorizationTest method isAllowedToWriteReturnsFalseIfTheRolesAreEmpty.
@Test
public void isAllowedToWriteReturnsFalseIfTheRolesAreEmpty() throws Exception {
VreAuthorization instance = VreAuthorization.create("", "");
boolean allowedToWrite = instance.isAllowedToWrite();
assertThat(allowedToWrite, is(false));
}
use of nl.knaw.huygens.timbuctoo.security.dto.VreAuthorization in project timbuctoo by HuygensING.
the class VreAuthorizationTest method hasAdminAccessReturnsTrueIfTheRolesContainAdmin.
// admin access
@Test
public void hasAdminAccessReturnsTrueIfTheRolesContainAdmin() throws Exception {
VreAuthorization instance = VreAuthorization.create("", "", ADMIN_ROLE);
boolean allowedToWrite = instance.hasAdminAccess();
assertThat(allowedToWrite, is(true));
}
use of nl.knaw.huygens.timbuctoo.security.dto.VreAuthorization in project timbuctoo by HuygensING.
the class LocalFileVreAuthorizationAccessTest method addAuthorizationReturnsTheAddedAuthorization.
@Test
public void addAuthorizationReturnsTheAddedAuthorization() throws Exception {
String unknownUser = "unknownUser";
VreAuthorization vreAuthorization = instance.getOrCreateAuthorization(VRE, unknownUser, UNVERIFIED_USER_ROLE);
Optional<VreAuthorization> authorization = instance.getAuthorization(VRE, unknownUser);
assertThat(vreAuthorization, is(authorization.get()));
}
Aggregations