Examples of UserRequestTO


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

        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

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.setupRestTemplate();

        // 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

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

        }
        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.setupRestTemplate();
View Full Code Here

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

                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.setupRestTemplate();
View Full Code Here

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

            @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);

                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

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

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

        UserRequestTO requestToDelete = binder.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

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

        UserTO userTO = UserTestITCase.getUniqueSampleTO("selfcreate@syncope.apache.org");

        // 2. get unauthorized when trying to request user create
        try {
            createUserRequest(userRequestService, new UserRequestTO(userTO));
            fail();
        } catch (SyncopeClientCompositeErrorException e) {
            assertNotNull(e.getException(SyncopeClientExceptionType.UnauthorizedRole));
        }

        // 3. set create request allowed
        configurationTO.setValue("true");

        response = configurationService.create(configurationTO);
        assertNotNull(response);
        assertEquals(org.apache.http.HttpStatus.SC_CREATED, response.getStatus());
        configurationTO = getObject(response, ConfigurationTO.class, configurationService);
        assertNotNull(configurationTO);

        // 4. as anonymous, request user create works
        UserRequestService userRequestService2 = setupCredentials(userRequestService, UserRequestService.class, null, null);
        response = createUserRequest(userRequestService2, new UserRequestTO(userTO));

        // 5. switch back to admin
        super.resetRestTemplate(); // TODO remove after CXF migration is complete

        // 6. try to find user
View Full Code Here

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

        userMod.setId(userTO.getId());
        userMod.setPassword(initialPassword);

        // 2. try to request user update as admin: failure
        try {
            createUserRequest(userRequestService, new UserRequestTO(userMod));
            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. update with same password: not matching password policy
        try {
            createUserRequest(userRequestService2, new UserRequestTO(userMod));
            fail();
        } catch (SyncopeClientCompositeErrorException scce) {
            assertNotNull(scce.getException(SyncopeClientExceptionType.InvalidSyncopeUser));
        }

        // 5. now request user update works
        userMod.setPassword("new" + initialPassword);
        createUserRequest(userRequestService2, new UserRequestTO(userMod));

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

        // 7. user password has not changed yet
View Full Code Here

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

        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
View Full Code Here

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

        return getRestTemplate().getForObject(baseUrl + "user/request/create/allowed.json", Boolean.class);
    }

    @Override
    public Response create(final UserRequestTO userRequestTO) {
        UserRequestTO created;
        switch (userRequestTO.getType()) {
            case UPDATE:
                created = getRestTemplate().postForObject(baseUrl + "user/request/update", userRequestTO.getUserMod(),
                        UserRequestTO.class);
                break;

            case DELETE:
                created = getRestTemplate().getForObject(baseUrl + "user/request/delete/{userId}", UserRequestTO.class,
                        userRequestTO.getUserId());
                break;

            case CREATE:
            default:
                created = getRestTemplate().postForObject(baseUrl + "user/request/create", userRequestTO.getUserTO(),
                        UserRequestTO.class);
        }

        URI location = URI.create(baseUrl + "user/request/read/" + created.getId() + ".json");
        return Response.created(location).header(SyncopeConstants.REST_HEADER_ID, created.getId()).build();
    }
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.