Skip to content
Snippets Groups Projects
Commit 7d38ebf0 authored by pkupczyk's avatar pkupczyk
Browse files

SSDM-6019 : Project Authorization - modify @RolesAllowed annotations at...

SSDM-6019 : Project Authorization - modify @RolesAllowed annotations at non-entity related methods - fix openbis tests

SVN: 39047
parent ad85174d
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,7 @@ public abstract class AbstractCollectionValidator<T> implements ICollectionValid ...@@ -40,6 +40,7 @@ public abstract class AbstractCollectionValidator<T> implements ICollectionValid
@Override @Override
public boolean isValid(PersonPE person, T value) public boolean isValid(PersonPE person, T value)
{ {
assert person != null;
Collection<T> valid = getValid(person, Arrays.asList(value)); Collection<T> valid = getValid(person, Arrays.asList(value));
return false == valid.isEmpty(); return false == valid.isEmpty();
} }
......
...@@ -116,9 +116,12 @@ public final class DefaultAccessControllerTest ...@@ -116,9 +116,12 @@ public final class DefaultAccessControllerTest
context.checking(new Expectations() context.checking(new Expectations()
{ {
{ {
allowing(authorizationConfig).isProjectLevelEnabled();
will(returnValue(false));
allowing(daoFactory).getAuthorizationConfig(); allowing(daoFactory).getAuthorizationConfig();
will(returnValue(authorizationConfig)); will(returnValue(authorizationConfig));
allowing(daoFactory).getProjectDAO(); allowing(daoFactory).getProjectDAO();
will(returnValue(projectDAO)); will(returnValue(projectDAO));
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package ch.systemsx.cisd.openbis.generic.server.dataaccess.db; package ch.systemsx.cisd.openbis.generic.server.dataaccess.db;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.testng.AssertJUnit; import org.testng.AssertJUnit;
...@@ -48,12 +49,13 @@ public final class GridCustomFilterDAOTest extends AbstractDAOTest ...@@ -48,12 +49,13 @@ public final class GridCustomFilterDAOTest extends AbstractDAOTest
@Test @Test
public void testCreateFilter() throws Exception public void testCreateFilter() throws Exception
{ {
AssertJUnit.assertEquals(0, daoFactory.getGridCustomFilterDAO().listAllEntities().size()); AssertJUnit.assertEquals(1, daoFactory.getGridCustomFilterDAO().listAllEntities().size());
GridCustomFilterPE filter = GridCustomFilterPE filter =
createFilter(NAME, GRID, DESCRIPTION, EXPRESSION, PUBLIC, getSystemPerson()); createFilter(NAME, GRID, DESCRIPTION, EXPRESSION, PUBLIC, getSystemPerson());
daoFactory.getGridCustomFilterDAO().createFilter(filter); daoFactory.getGridCustomFilterDAO().createFilter(filter);
List<GridCustomFilterPE> filters = daoFactory.getGridCustomFilterDAO().listAllEntities(); List<GridCustomFilterPE> filters = daoFactory.getGridCustomFilterDAO().listAllEntities();
AssertJUnit.assertEquals(1, filters.size()); Collections.sort(filters);
AssertJUnit.assertEquals(2, filters.size());
AssertJUnit.assertEquals(filter, filters.get(0)); AssertJUnit.assertEquals(filter, filters.get(0));
} }
......
...@@ -179,6 +179,7 @@ public class ProjectAuthorizationMigrationTest extends SystemTestCase ...@@ -179,6 +179,7 @@ public class ProjectAuthorizationMigrationTest extends SystemTestCase
private static IAuthSessionProvider createSessionWithRoles(RoleWithHierarchy... roles) private static IAuthSessionProvider createSessionWithRoles(RoleWithHierarchy... roles)
{ {
PersonPE person = new PersonPE(); PersonPE person = new PersonPE();
person.setUserId("some_user_with_pa_on");
for (RoleWithHierarchy role : roles) for (RoleWithHierarchy role : roles)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment