Package org.apache.syncope.client.to

Examples of org.apache.syncope.client.to.UserRequestTO


        configurationTO = restTemplate.postForObject(BASE_URL + "configuration/create", configurationTO,
                ConfigurationTO.class);
        assertNotNull(configurationTO);

        // 4. as anonymous, request user create works
        UserRequestTO request = anonymousRestTemplate().postForObject(BASE_URL + "user/request/create", userTO,
                UserRequestTO.class);
        assertNotNull(request);

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

        // 6. try to find user
        AttributeCond attrCond = new AttributeCond(AttributeCond.Type.EQ);
        attrCond.setSchema("userId");
        attrCond.setExpression("selfcreate@syncope.apache.org");

        final List<UserTO> matchingUsers = Arrays.asList(restTemplate.postForObject(BASE_URL + "user/search", NodeCond.
                getLeafCond(attrCond), UserTO[].class));
        assertTrue(matchingUsers.isEmpty());

        // 7. actually create user
        userTO = restTemplate.postForObject(BASE_URL + "user/create", request.getUserTO(), UserTO.class);
        assertNotNull(userTO);
    }
View Full Code Here


        }
        assertNotNull(exception);

        // 5. now request user update works
        userMod.setPassword("new" + initialPassword);
        UserRequestTO request = restTemplate.postForObject(BASE_URL + "user/request/update", userMod,
                UserRequestTO.class);
        assertNotNull(request);

        // 6. switch back to admin
        super.resetRestTemplate();
View Full Code Here

                getRequestFactory());
        ((DefaultHttpClient) requestFactory.getHttpClient()).getCredentialsProvider().setCredentials(
                requestFactory.getAuthScope(), new UsernamePasswordCredentials(userTO.getUsername(), initialPassword));

        // 4. now request user delete works
        UserRequestTO request = restTemplate.getForObject(BASE_URL + "user/request/delete/{userId}",
                UserRequestTO.class, userTO.getId());
        assertNotNull(request);

        // 5. switch back to admin
        super.resetRestTemplate();
View Full Code Here

        configurationTO = restTemplate.postForObject(BASE_URL + "configuration/create", configurationTO,
                ConfigurationTO.class);
        assertNotNull(configurationTO);

        // 4. as anonymous, request user create works
        UserRequestTO request = anonymousRestTemplate().postForObject(BASE_URL + "user/request/create", userTO,
                UserRequestTO.class);
        assertNotNull(request);

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

        // 6. try to find user
        AttributeCond attrCond = new AttributeCond(AttributeCond.Type.EQ);
        attrCond.setSchema("userId");
        attrCond.setExpression("selfcreate@syncope.apache.org");

        final List<UserTO> matchingUsers = Arrays.asList(restTemplate.postForObject(BASE_URL + "user/search", NodeCond.
                getLeafCond(attrCond), UserTO[].class));
        assertTrue(matchingUsers.isEmpty());

        // 7. actually create user
        userTO = restTemplate.postForObject(BASE_URL + "user/create", request.getUserTO(), UserTO.class);
        assertNotNull(userTO);
    }
View Full Code Here

        }
        assertNotNull(exception);

        // 5. now request user update works
        userMod.setPassword("new" + initialPassword);
        UserRequestTO request = restTemplate.postForObject(BASE_URL + "user/request/update", userMod,
                UserRequestTO.class);
        assertNotNull(request);

        // 6. switch back to admin
        super.resetRestTemplate();
View Full Code Here

                getRequestFactory());
        ((DefaultHttpClient) requestFactory.getHttpClient()).getCredentialsProvider().setCredentials(
                requestFactory.getAuthScope(), new UsernamePasswordCredentials(userTO.getUsername(), initialPassword));

        // 4. now request user delete works
        UserRequestTO request = restTemplate.getForObject(BASE_URL + "user/request/delete/{userId}",
                UserRequestTO.class, userTO.getId());
        assertNotNull(request);

        // 5. switch back to admin
        super.resetRestTemplate();
View Full Code Here

        UserRequest request = userRequestDAO.find(requestId);
        if (request == null) {
            throw new NotFoundException("User request " + requestId);
        }

        UserRequestTO requestToDelete = dataBinder.getUserRequestTO(request);

        auditManager.audit(Category.userRequest, UserRequestSubCategory.delete, Result.success,
                "Successfully deleted user request for user" + request.getUserId());

        userRequestDAO.delete(requestId);
View Full Code Here

            @Override
            public void populateItem(final Item<ICellPopulator<UserRequestTO>> cellItem, final String componentId,
                    final IModel<UserRequestTO> model) {

                final UserRequestTO request = model.getObject();

                final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference());

                panel.add(new ActionLink() {

                    private static final long serialVersionUID = -3722207913631435501L;

                    @Override
                    public void onClick(final AjaxRequestTarget target) {
                        editUserRequestWin.setPageCreator(new ModalWindow.PageCreator() {

                            private static final long serialVersionUID = -7834632442532690940L;

                            @Override
                            public Page createPage() {
                                return new UserRequestModalPage(Todo.this.getPageReference(), editUserRequestWin,
                                        model.getObject(), UserModalPage.Mode.ADMIN);
                            }
                        });

                        editUserRequestWin.show(target);
                    }
                }, ActionLink.ActionType.EDIT, "UserRequest", "read",
                        model.getObject().getType() != UserRequestType.DELETE);

                panel.add(new ActionLink() {

                    private static final long serialVersionUID = -3722207913631435501L;

                    @Override
                    public void onClick(final AjaxRequestTarget target) {
                        try {
                            userRestClient.delete(model.getObject().getUserId());
                            userRequestRestClient.delete(model.getObject().getId());
                        } catch (SyncopeClientCompositeErrorException e) {
                            LOG.error("While deleting an user", e);
                            error(e.getMessage());
                            return;
                        }

                        info(getString("operation_succeded"));
                        target.add(feedbackPanel);

                        target.add(userRequestContainer);
                    }
                }, ActionLink.ActionType.DELETE, "Users", "delete",
                        model.getObject().getType() == UserRequestType.DELETE);

                panel.add(new ActionLink() {

                    private static final long serialVersionUID = -3722207913631435501L;

                    @Override
                    public void onClick(final AjaxRequestTarget target) {
                        try {
                            userRequestRestClient.delete(request.getId());
                        } catch (SyncopeClientCompositeErrorException e) {
                            LOG.error("While deleting an user request", e);
                            error(e.getMessage());
                            return;
                        }
View Full Code Here

        SyncopeUser authUser = userDAO.find(SecurityContextHolder.getContext().getAuthentication().getName());
        return userDataBinder.getUserTO(authUser);
    }

    public UserRequestTO getUserRequestTO(final UserRequest request) {
        UserRequestTO result = new UserRequestTO();
        BeanUtils.copyProperties(request, result);

        return result;
    }
View Full Code Here

        SyncopeUser authUser = userDAO.find(SecurityContextHolder.getContext().getAuthentication().getName());
        return userDataBinder.getUserTO(authUser);
    }

    public UserRequestTO getUserRequestTO(final UserRequest request) {
        UserRequestTO result = new UserRequestTO();
        BeanUtils.copyProperties(request, result);

        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.syncope.client.to.UserRequestTO

Copyright © 2018 www.massapicom. 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.