Examples of RoleService


Examples of com.ateam.webstore.service.impl.RoleService

                    View rv = new View(getAdminHomeView());
                    Employee e = null;
                    try {
                        String ssn = Utilities.padStringToLength(Math.abs(new Random().nextInt())+"", "0", 9, false);
                        e = service.registerEmployee(add.getFirstName(), add.getLastName(), add.getEmail(), add.getPw(), new Long(1), "foo", ssn, "Employee", new Date(new java.util.Date().getTime()), "A1", new Double(100000));
                        RoleService rs = new RoleService();
                        Role role = rs.getById(new Integer(add.getRoleId()));
                        EmployeeRoles er = new EmployeeRoles(new Date(new java.util.Date().getTime()), e, role);
                        EmployeeRolesService ers = new EmployeeRolesService();
                        ers.store(er);
                            rv.setMessage("Employee addition Complete");
                            add.setResultMessage("Employee successfull added");
View Full Code Here

Examples of com.ateam.webstore.service.impl.RoleService

     
      aeav.addContentView(new ContentView(JSP_REGISTRATION, "New Employee"));
     
      aeav.setAdmin(true);
     
      RoleService rs = new RoleService();
      aeav.setRoles(rs.getAll());
     
      return aeav;
    }
View Full Code Here

Examples of gov.nasa.arc.mct.platform.spi.RoleService

        return result.toArray(new Object[result.size()][]);
    }
   
    @Test
    public void testUsesRoleService() {
        RoleService mockRoleService = Mockito.mock(RoleService.class);
        new RoleAccess().addRoleService(mockRoleService);
       
        AbstractComponent mockComponent = Mockito.mock(AbstractComponent.class);
       
        Mockito.when(mockPlatform.getCurrentUser()).thenReturn(mockUser);
        Mockito.when(mockUser.getUserId()).thenReturn("testUser1");
        Mockito.when(mockUser.getDisciplineId()).thenReturn("testGroup1");
        Mockito.when(mockComponent.getOwner()).thenReturn("testRole1");
       
        Mockito.verifyZeroInteractions(mockRoleService);
               
        PolicyContext context = new PolicyContext();
        context.setProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), pseudoComponent);
       
        Mockito.when(mockRoleService.hasRole(Mockito.<User>any(), Mockito.anyString())).thenReturn(false);
        Assert.assertFalse(ownershipPolicy.execute(context).getStatus());
       
        Mockito.when(mockRoleService.hasRole(Mockito.<User>any(), Mockito.anyString())).thenReturn(true);             
        Assert.assertTrue(ownershipPolicy.execute(context).getStatus());
       
        new RoleAccess().removeRoleService(mockRoleService);
    }
View Full Code Here

Examples of org.apache.syncope.common.services.RoleService

        RoleMod roleMod = new RoleMod();
        roleMod.setId(roleTO.getId());
        roleMod.setName("Managing Director");

        // 3. try to update as verdi, not owner of role 7 - fail
        RoleService roleService2 = setupCredentials(roleService, RoleService.class, "verdi", ADMIN_PWD);

        try {
            roleService2.update(roleMod.getId(), roleMod);
            fail();
        } catch (HttpStatusCodeException e) {
            assertEquals(HttpStatus.FORBIDDEN, e.getStatusCode());
        } catch (AccessControlException e) {
            assertNotNull(e);
        }

        // 4. update as puccini, owner of role 7 because owner of role 6 with
        // inheritance - success
        RoleService roleService3 = setupCredentials(roleService, RoleService.class, "puccini", ADMIN_PWD);

        roleTO = roleService3.update(roleMod.getId(), roleMod);
        assertEquals("Managing Director", roleTO.getName());
    }
View Full Code Here

Examples of org.apache.syncope.common.services.RoleService

        assertNotNull(userTO);

        assertTrue(userTO.getMembershipMap().containsKey(1L));
        assertFalse(userTO.getMembershipMap().containsKey(3L));

        RoleService roleService2 = setupCredentials(roleService, RoleService.class, "rossini", ADMIN_PWD);

        SyncopeClientException exception = null;
        try {
            roleService2.selfRead(3L);
            fail();
        } catch (SyncopeClientCompositeErrorException e) {
            exception = e.getException(SyncopeClientExceptionType.UnauthorizedRole);
        }
        assertNotNull(exception);

        RoleTO roleTO = roleService2.selfRead(1L);
        assertNotNull(roleTO);
        assertNotNull(roleTO.getAttributes());
        assertFalse(roleTO.getAttributes().isEmpty());
    }
View Full Code Here

Examples of org.apache.syncope.common.services.RoleService

        assertNotNull(userTO);

        assertTrue(userTO.getMembershipMap().containsKey(1L));
        assertFalse(userTO.getMembershipMap().containsKey(3L));

        RoleService roleService2 = setupCredentials(roleService, RoleService.class, "rossini", ADMIN_PWD);

        SyncopeClientException exception = null;
        try {
            roleService2.selfRead(3L);
            fail();
        } catch (SyncopeClientCompositeErrorException e) {
            exception = e.getException(SyncopeClientExceptionType.UnauthorizedRole);
        }
        assertNotNull(exception);

        RoleTO roleTO = roleService2.selfRead(1L);
        assertNotNull(roleTO);
        assertNotNull(roleTO.getAttributes());
        assertFalse(roleTO.getAttributes().isEmpty());
    }
View Full Code Here

Examples of org.apache.syncope.common.services.RoleService

        RoleMod roleMod = new RoleMod();
        roleMod.setId(roleTO.getId());
        roleMod.setName("Managing Director");

        // 3. try to update as verdi, not owner of role 7 - fail
        RoleService roleService2 = setupCredentials(roleService, RoleService.class, "verdi", ADMIN_PWD);

        try {
            roleService2.update(roleMod.getId(), roleMod);
            fail();
        } catch (HttpStatusCodeException e) {
            assertEquals(HttpStatus.FORBIDDEN, e.getStatusCode());
        } catch (AccessControlException e) {
            assertNotNull(e);
        }

        // 4. update as puccini, owner of role 7 because owner of role 6 with
        // inheritance - success
        RoleService roleService3 = setupCredentials(roleService, RoleService.class, "puccini", ADMIN_PWD);

        roleTO = roleService3.update(roleMod.getId(), roleMod);
        assertEquals("Managing Director", roleTO.getName());
    }
View Full Code Here

Examples of org.apache.syncope.common.services.RoleService

        assertNotNull(userTO);

        assertTrue(userTO.getMembershipMap().containsKey(1L));
        assertFalse(userTO.getMembershipMap().containsKey(3L));

        RoleService roleService2 = setupCredentials(roleService, RoleService.class, "rossini", ADMIN_PWD);

        SyncopeClientException exception = null;
        try {
            roleService2.selfRead(3L);
            fail();
        } catch (SyncopeClientCompositeErrorException e) {
            exception = e.getException(SyncopeClientExceptionType.UnauthorizedRole);
        }
        assertNotNull(exception);

        RoleTO roleTO = roleService2.selfRead(1L);
        assertNotNull(roleTO);
        assertNotNull(roleTO.getAttributes());
        assertFalse(roleTO.getAttributes().isEmpty());
    }
View Full Code Here

Examples of org.apache.syncope.common.services.RoleService

        RoleMod roleMod = new RoleMod();
        roleMod.setId(roleTO.getId());
        roleMod.setName("Managing Director");

        // 3. try to update as verdi, not owner of role 7 - fail
        RoleService roleService2 = setupCredentials(roleService, RoleService.class, "verdi", ADMIN_PWD);

        try {
            roleService2.update(roleMod.getId(), roleMod);
            fail();
        } catch (HttpStatusCodeException e) {
            assertEquals(HttpStatus.FORBIDDEN, e.getStatusCode());
        } catch (AccessControlException e) {
            assertNotNull(e);
        }

        // 4. update as puccini, owner of role 7 because owner of role 6 with
        // inheritance - success
        RoleService roleService3 = setupCredentials(roleService, RoleService.class, "puccini", ADMIN_PWD);

        roleTO = roleService3.update(roleMod.getId(), roleMod);
        assertEquals("Managing Director", roleTO.getName());
    }
View Full Code Here

Examples of org.apache.syncope.common.services.RoleService

        assertNotNull(userTO);

        assertTrue(userTO.getMembershipMap().containsKey(1L));
        assertFalse(userTO.getMembershipMap().containsKey(3L));

        RoleService roleService2 = setupCredentials(roleService, RoleService.class, "rossini", ADMIN_PWD);

        SyncopeClientException exception = null;
        try {
            roleService2.selfRead(3L);
            fail();
        } catch (SyncopeClientCompositeErrorException e) {
            exception = e.getException(SyncopeClientExceptionType.UnauthorizedRole);
        }
        assertNotNull(exception);

        RoleTO roleTO = roleService2.selfRead(1L);
        assertNotNull(roleTO);
        assertNotNull(roleTO.getAttributes());
        assertFalse(roleTO.getAttributes().isEmpty());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.