Search in sources :

Example 26 with JsonEntityBean

use of org.apereo.portal.layout.dlm.remoting.JsonEntityBean in project uPortal by Jasig.

the class PermissionsRESTControllerTest method testGetgetAssignmentsForTargetNull.

@Test
public void testGetgetAssignmentsForTargetNull() throws Exception {
    String target = "target";
    boolean includeInherited = false;
    JsonEntityBean entity = buildJsonPersonEntityBean();
    Mockito.when(permissionStore.select(null, null, null, target, null)).thenReturn(new IPermission[0]);
    Mockito.when(groupListHelper.getEntityForPrincipal(target)).thenReturn(null);
    Mockito.when(this.authorizationService.newPrincipal(entity.getId(), entity.getEntityType().getClazz())).thenReturn(null);
    ModelAndView modelAndView = permissionsRESTController.getAssignmentsOnTarget(target, includeInherited, req, res);
    Collection<IPermissionTarget> assignments = (Collection<IPermissionTarget>) modelAndView.getModel().get("assignments");
}
Also used : JsonEntityBean(org.apereo.portal.layout.dlm.remoting.JsonEntityBean) IPermissionTarget(org.apereo.portal.permission.target.IPermissionTarget) ModelAndView(org.springframework.web.servlet.ModelAndView) Collection(java.util.Collection) Test(org.junit.Test)

Example 27 with JsonEntityBean

use of org.apereo.portal.layout.dlm.remoting.JsonEntityBean in project uPortal by Jasig.

the class PermissionsRESTControllerTest method buildJsonPersonEntityBean.

private JsonEntityBean buildJsonPersonEntityBean() {
    JsonEntityBean personBean = new JsonEntityBean();
    personBean.setEntityType(EntityEnum.GROUP.toString());
    personBean.setId("person101");
    personBean.setName("test");
    personBean.setDescription("Testing person bean");
    return personBean;
}
Also used : JsonEntityBean(org.apereo.portal.layout.dlm.remoting.JsonEntityBean)

Example 28 with JsonEntityBean

use of org.apereo.portal.layout.dlm.remoting.JsonEntityBean in project uPortal by Jasig.

the class PermissionAssignmentMapControllerTest method buildJsonEntityBean.

private JsonEntityBean buildJsonEntityBean() {
    JsonEntityBean bean = new JsonEntityBean();
    bean.setEntityType(ENTITY_TYPE);
    bean.setId(ENTITY_ID_101);
    bean.setName("test");
    bean.setDescription("Testing bean");
    return bean;
}
Also used : JsonEntityBean(org.apereo.portal.layout.dlm.remoting.JsonEntityBean)

Example 29 with JsonEntityBean

use of org.apereo.portal.layout.dlm.remoting.JsonEntityBean in project uPortal by Jasig.

the class AssignmentTest method buildJsonGroupEntityBean.

private JsonEntityBean buildJsonGroupEntityBean() {
    JsonEntityBean groupBean = new JsonEntityBean();
    groupBean.setEntityType(EntityEnum.GROUP.toString());
    groupBean.setId("group101");
    groupBean.setName("test");
    groupBean.setDescription("Testing group bean");
    return groupBean;
}
Also used : JsonEntityBean(org.apereo.portal.layout.dlm.remoting.JsonEntityBean)

Example 30 with JsonEntityBean

use of org.apereo.portal.layout.dlm.remoting.JsonEntityBean in project uPortal by Jasig.

the class AssignmentTest method testAddChild.

@Test
public void testAddChild() {
    String principal = "principal1";
    JsonEntityBean principalBean = buildJsonGroupEntityBean();
    Assignment newAssignment = assignment.addChild(new Assignment(principal, principalBean));
    Assert.assertEquals(1L, newAssignment.getChildren().size());
}
Also used : JsonEntityBean(org.apereo.portal.layout.dlm.remoting.JsonEntityBean) Test(org.junit.Test)

Aggregations

JsonEntityBean (org.apereo.portal.layout.dlm.remoting.JsonEntityBean)86 Test (org.junit.Test)53 EntityEnum (org.apereo.portal.portlets.groupselector.EntityEnum)13 ModelAndView (org.springframework.web.servlet.ModelAndView)10 IEntityGroup (org.apereo.portal.groups.IEntityGroup)9 IGroupMember (org.apereo.portal.groups.IGroupMember)9 IAuthorizationPrincipal (org.apereo.portal.security.IAuthorizationPrincipal)9 ArrayList (java.util.ArrayList)7 HashSet (java.util.HashSet)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 IPermission (org.apereo.portal.security.IPermission)4 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)4 List (java.util.List)3 IPermissionTarget (org.apereo.portal.permission.target.IPermissionTarget)3 PortletCategory (org.apereo.portal.portlet.om.PortletCategory)3 IPerson (org.apereo.portal.security.IPerson)3 Collection (java.util.Collection)2 HashMap (java.util.HashMap)2 GroupListHelperImpl (org.apereo.portal.layout.dlm.remoting.GroupListHelperImpl)2 IPermissionActivity (org.apereo.portal.permission.IPermissionActivity)2