Search in sources :

Example 1 with Project

use of io.crnk.security.model.Project in project crnk-framework by crnk-project.

the class SecurityModuleIntTest method metaAllPermissions.

@Test
public void metaAllPermissions() {
    identityManager.addUser("doe", "doePass", "allRole");
    ResourceList<Project> list = projectRepo.findAll(new QuerySpec(Project.class));
    ResourcePermissionInformation metaInformation = list.getMeta(ResourcePermissionInformationImpl.class);
    ResourcePermission resourcePermission = metaInformation.getResourcePermission();
    Assert.assertEquals(ResourcePermission.ALL, resourcePermission);
}
Also used : Project(io.crnk.security.model.Project) QuerySpec(io.crnk.core.queryspec.QuerySpec) Test(org.junit.Test)

Example 2 with Project

use of io.crnk.security.model.Project in project crnk-framework by crnk-project.

the class SecurityModuleIntTest method rootAll.

@Test
public void rootAll() {
    identityManager.addUser("doe", "doePass", "allRole");
    Project project = new Project();
    project.setId(1L);
    project.setName("test");
    projectRepo.create(project);
    project.setName("updated");
    projectRepo.save(project);
    project = projectRepo.findOne(project.getId(), new QuerySpec(Project.class));
    Assert.assertNotNull(project);
    projectRepo.delete(project.getId());
}
Also used : Project(io.crnk.security.model.Project) QuerySpec(io.crnk.core.queryspec.QuerySpec) Test(org.junit.Test)

Example 3 with Project

use of io.crnk.security.model.Project in project crnk-framework by crnk-project.

the class SecurityModuleIntTest method getPostOnly.

@Test
public void getPostOnly() {
    identityManager.addUser("doe", "doePass", "getRole", "postRole");
    Project project = new Project();
    project.setId(1L);
    project.setName("test");
    projectRepo.create(project);
    project = projectRepo.findOne(project.getId(), new QuerySpec(Project.class));
    Assert.assertNotNull(project);
}
Also used : Project(io.crnk.security.model.Project) QuerySpec(io.crnk.core.queryspec.QuerySpec) Test(org.junit.Test)

Example 4 with Project

use of io.crnk.security.model.Project in project crnk-framework by crnk-project.

the class SecurityModuleIntTest method permitAllMatchProjectType.

@Test
public void permitAllMatchProjectType() {
    identityManager.addUser("doe", "doePass");
    Project project = new Project();
    project.setId(1L);
    project.setName("test");
    projectRepo.create(project);
}
Also used : Project(io.crnk.security.model.Project) Test(org.junit.Test)

Example 5 with Project

use of io.crnk.security.model.Project in project crnk-framework by crnk-project.

the class SecurityModuleIntTest method metaGetPatchPermissions.

@Test
public void metaGetPatchPermissions() {
    identityManager.addUser("doe", "doePass");
    ResourceList<Project> list = projectRepo.findAll(new QuerySpec(Project.class));
    ResourcePermissionInformation metaInformation = list.getMeta(ResourcePermissionInformationImpl.class);
    ResourcePermission resourcePermission = metaInformation.getResourcePermission();
    Assert.assertEquals(ResourcePermission.GET.or(ResourcePermission.POST), resourcePermission);
}
Also used : Project(io.crnk.security.model.Project) QuerySpec(io.crnk.core.queryspec.QuerySpec) Test(org.junit.Test)

Aggregations

Project (io.crnk.security.model.Project)6 Test (org.junit.Test)6 QuerySpec (io.crnk.core.queryspec.QuerySpec)4