Examples of UserTO


Examples of org.apache.syncope.common.to.UserTO

    }

    @Test
    public void delete() {
        // 1. create an user (as admin)
        UserTO userTO = UserTestITCase.getUniqueSampleTO("selfdelete@syncope.apache.org");
        String initialPassword = userTO.getPassword();

        userTO = createUser(userTO);
        assertNotNull(userTO);

        // 2. try to request user delete as admin: failure
        try {
            createUserRequest(userRequestService, new UserRequestTO(userTO.getId()));
            fail();
        } catch (SyncopeClientCompositeErrorException e) {
            assertNotNull(e.getException(SyncopeClientExceptionType.UnauthorizedRole));
        }

        // 3. auth as user just created
        UserRequestService userRequestService2 = setupCredentials(userRequestService, UserRequestService.class,
                userTO.getUsername(), initialPassword);

        // 4. now request user delete works
        createUserRequest(userRequestService2, new UserRequestTO(userTO.getId()));

        // 5. switch back to admin
        super.resetRestTemplate();

        // 6. user still exists
        UserTO actual = userService.read(userTO.getId());
        assertNotNull(actual);

        // 7. actually delete user
        userService.delete(userTO.getId());
View Full Code Here

Examples of org.apache.syncope.common.to.UserTO

    public <T extends AbstractAttributableTO> T newAttributableTO() {
        T result = null;

        switch (type) {
            case USER:
                result = (T) new UserTO();
                break;
            case ROLE:
                result = (T) new RoleTO();
                break;
            case MEMBERSHIP:
View Full Code Here

Examples of org.apache.syncope.common.to.UserTO

        return getSampleTO(getUUIDString() + email);
    }

    public static UserTO getSampleTO(final String email) {
        String uid = email;
        UserTO userTO = new UserTO();
        userTO.setPassword("password123");
        userTO.setUsername(uid);

        userTO.addAttribute(attributeTO("fullname", uid));
        userTO.addAttribute(attributeTO("firstname", uid));
        userTO.addAttribute(attributeTO("surname", "surname"));
        userTO.addAttribute(attributeTO("type", "a type"));
        userTO.addAttribute(attributeTO("userId", uid));
        userTO.addAttribute(attributeTO("email", uid));
        DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        userTO.addAttribute(attributeTO("loginDate", sdf.format(new Date())));
        userTO.addDerivedAttribute(attributeTO("cn", null));
        userTO.addVirtualAttribute(attributeTO("virtualdata", "virtualvalue"));
        return userTO;
    }
View Full Code Here

Examples of org.apache.syncope.common.to.UserTO

        } catch (AccessControlException e) {
            // Will be thrown by cxf service
            assertNotNull(e);
        }

        UserTO userTO = userService2.readSelf();
        assertEquals("rossini", userTO.getUsername());
    }
View Full Code Here

Examples of org.apache.syncope.common.to.UserTO

        assertFalse(tasks.isEmpty());

        long maxId = getMaxTaskId(tasks);

        // create a new user
        UserTO userTO = getUniqueSampleTO("xxx@xxx.xxx");

        userTO.setPassword("password123");
        userTO.addResource("ws-target-resource-nopropagation");

        createUser(userTO);

        // get the new task list
        tasks = (List<PropagationTaskTO>) taskService.list(TaskType.PROPAGATION);
View Full Code Here

Examples of org.apache.syncope.common.to.UserTO

        for (PasswordPolicyTO policyTO : policies) {
            policyService.delete(PolicyType.PASSWORD, policyTO.getId());
        }

        try {
            UserTO userTO = getUniqueSampleTO("issue172@syncope.apache.org");
            createUser(userTO);
        } finally {
            for (PasswordPolicyTO policyTO : policies) {
                Response response = policyService.create(PolicyType.GLOBAL_PASSWORD, policyTO);
                PolicyTO cPolicyTO = getObject(response, PasswordPolicyTO.class, policyService);
View Full Code Here

Examples of org.apache.syncope.common.to.UserTO

    }

    @Test
    public void issue186() {
        // 1. create an user with strict mandatory attributes only
        UserTO userTO = new UserTO();
        String userId = getUUIDString() + "issue186@syncope.apache.org";
        userTO.setUsername(userId);
        userTO.setPassword("password");

        userTO.addAttribute(attributeTO("userId", userId));
        userTO.addAttribute(attributeTO("fullname", userId));
        userTO.addAttribute(attributeTO("surname", userId));

        userTO = createUser(userTO);
        assertNotNull(userTO);
        assertTrue(userTO.getResources().isEmpty());

        // 2. update assigning a resource forcing mandatory constraints: must fail with RequiredValuesMissing
        UserMod userMod = new UserMod();
        userMod.setId(userTO.getId());
        userMod.setPassword("newPassword");
        userMod.addResourceToBeAdded("ws-target-resource-2");

        SyncopeClientException sce = null;
        try {
            userTO = userService.update(userMod.getId(), userMod);
        } catch (SyncopeClientCompositeErrorException scce) {
            sce = scce.getException(SyncopeClientExceptionType.RequiredValuesMissing);
        }
        assertNotNull(sce);

        // 3. update assigning a resource NOT forcing mandatory constraints
        // AND primary: must fail with PropagationException
        userMod = new UserMod();
        userMod.setId(userTO.getId());
        userMod.setPassword("newPassword");
        userMod.addResourceToBeAdded("ws-target-resource-1");

        sce = null;
        try {
            userTO = userService.update(userMod.getId(), userMod);
        } catch (SyncopeClientCompositeErrorException scce) {
            sce = scce.getException(SyncopeClientExceptionType.Propagation);
        }
        assertNotNull(sce);

        // 4. update assigning a resource NOT forcing mandatory constraints
        // BUT not primary: must succeed
        userMod = new UserMod();
        userMod.setId(userTO.getId());
        userMod.setPassword("newPassword");
        userMod.addResourceToBeAdded("resource-db");

        sce = null;
        try {
View Full Code Here

Examples of org.apache.syncope.common.to.UserTO

            private static final long serialVersionUID = -7978723352517770644L;

            @Override
            public void onClick(final AjaxRequestTarget target) {
                final UserTO userTO = SyncopeSession.get().isAuthenticated()
                        ? userRestClient.readProfile()
                        : new UserTO();

                editProfileModalWin.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690940L;
View Full Code Here

Examples of org.apache.syncope.common.to.UserTO

        return userController.countInternal();
    }

    @Override
    public Response create(final UserTO userTO) {
        UserTO created = userController.createInternal(userTO);
        URI location = uriInfo.getAbsolutePathBuilder().path(created.getId() + "").build();
        return Response.created(location).header(SyncopeConstants.REST_HEADER_ID, created.getId()).entity(created)
                .build();
    }
View Full Code Here

Examples of org.apache.syncope.common.to.UserTO

        this.resource = resource;
    }

    public UserTO getUserTemplate() {
        return userTemplate == null
                ? new UserTO()
                : XMLSerializer.<UserTO>deserialize(userTemplate);
    }
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.