Package org.apache.syncope.core.persistence.beans.user

Examples of org.apache.syncope.core.persistence.beans.user.SyncopeUser


        assertEquals(1, actual.getPasswordHistory().size());
    }

    @Test
    public void delete() {
        SyncopeUser user = userDAO.find(3L);

        userDAO.delete(user.getId());

        SyncopeUser actual = userDAO.find(3L);
        assertNull("delete did not work", actual);
    }
View Full Code Here


        assertNull("delete did not work", actual);
    }

    @Test
    public void issue237() {
        SyncopeUser user = new SyncopeUser();
        user.setUsername("username");
        user.setCreationDate(new Date());

        user.setPassword("password", CipherAlgorithm.AES, 0);

        SyncopeUser actual = userDAO.save(user);
        assertNotNull(actual);
    }
View Full Code Here

    protected void doExecute(final DelegateExecution execution) throws Exception {

        UserTO userTO = (UserTO) execution.getVariable(ActivitiUserWorkflowAdapter.USER_TO);

        // create and set workflow id
        SyncopeUser user = new SyncopeUser();
        dataBinder.create(user, userTO);
        user.setWorkflowId(execution.getProcessInstanceId());

        // report SyncopeUser as result
        execution.setVariable(ActivitiUserWorkflowAdapter.SYNCOPE_USER, user);
    }
View Full Code Here

public class Delete extends AbstractActivitiDelegate {

    @Override
    protected void doExecute(final DelegateExecution execution) throws Exception {

        SyncopeUser user = (SyncopeUser) execution.getVariable(ActivitiUserWorkflowAdapter.SYNCOPE_USER);

        // TODO: do something with SyncopeUser...
        if (user != null) {
            user.checkToken("");
        }

        // remove SyncopeUser variable
        execution.removeVariable(ActivitiUserWorkflowAdapter.SYNCOPE_USER);
    }
View Full Code Here

public class Update extends AbstractActivitiDelegate {

    @Override
    protected void doExecute(final DelegateExecution execution) throws Exception {
        SyncopeUser user = (SyncopeUser) execution.getVariable(ActivitiUserWorkflowAdapter.SYNCOPE_USER);
        UserMod userMod = (UserMod) execution.getVariable(ActivitiUserWorkflowAdapter.USER_MOD);

        // update SyncopeUser
        PropagationByResource propByRes = dataBinder.update(user, userMod);
View Full Code Here

        return new UserEntity(syncopeUser.getUsername());
    }

    private void execute(final int page, final int itemsPerPage) {
        if (username != null) {
            SyncopeUser user = userDAO.find(username);
            if (user == null) {
                result = Collections.<User>emptyList();
            } else {
                if (memberOf == null || user.getRoleIds().contains(memberOf)) {
                    result = Collections.singletonList(fromSyncopeUser(user));
                }
            }
        }
        if (memberOf != null) {
View Full Code Here

    }

    @Override
    public List<Group> findGroupsByUser(final String userId) {
        List<Group> result = Collections.emptyList();
        SyncopeUser user = userDAO.find(userId);
        if (user != null) {
            result = new ArrayList<Group>();
            for (Long roleId : user.getRoleIds()) {
                result.add(new GroupEntity(roleId.toString()));
            }
        }

        return result;
View Full Code Here

        if (role == null) {
            throw new NotFoundException("Role " + roleId);
        }

        Set<Long> ownedRoleIds;
        SyncopeUser authUser = userDAO.find(SecurityContextHolder.getContext().getAuthentication().getName());
        if (authUser == null) {
            ownedRoleIds = Collections.<Long>emptySet();
        } else {
            ownedRoleIds = authUser.getRoleIds();
        }

        Set<Long> allowedRoleIds = EntitlementUtil.getRoleIds(EntitlementUtil.getOwnedEntitlementNames());
        allowedRoleIds.addAll(ownedRoleIds);
        if (!allowedRoleIds.contains(role.getId())) {
View Full Code Here

    protected abstract WorkflowResult<Long> doReactivate(SyncopeUser user) throws WorkflowException;

    @Override
    public WorkflowResult<Long> reactivate(final Long userId) throws UnauthorizedRoleException, WorkflowException {
        final SyncopeUser user = dataBinder.getUserFromId(userId);

        // reset failed logins
        user.setFailedLogins(0);

        // reset suspended flag
        user.setSuspended(Boolean.FALSE);

        return doReactivate(user);
    }
View Full Code Here

            processInstance = runtimeService.startProcessInstanceByKey(WF_PROCESS_ID, variables);
        } catch (ActivitiException e) {
            throw new WorkflowException("While starting " + WF_PROCESS_ID + " instance", e);
        }

        SyncopeUser user = (SyncopeUser) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                SYNCOPE_USER);

        Boolean updatedEnabled = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(), ENABLED);
        if (updatedEnabled != null) {
            user.setSuspended(!updatedEnabled);
        }

        // this will make SyncopeUserValidator not to consider password policies at all
        if (disablePwdPolicyCheck) {
            user.removeClearPassword();
        }

        updateStatus(user);
        user = userDAO.save(user);

        Boolean propagateEnable = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                PROPAGATE_ENABLE);
        if (propagateEnable == null) {
            propagateEnable = enabled;
        }

        // save resources to be propagated and password for later - after form submission - propagation
        PropagationByResource propByRes = new PropagationByResource();
        propByRes.set(ResourceOperation.CREATE, user.getResourceNames());

        String formTaskId = getFormTask(user);
        if (formTaskId != null) {
            // SYNCOPE-238: This is needed to simplify the task query in this.getForms()
            taskService.setVariableLocal(formTaskId, TASK_IS_FORM, Boolean.TRUE);
            runtimeService.setVariable(processInstance.getProcessInstanceId(), PROP_BY_RESOURCE, propByRes);
            propByRes = null;

            if (StringUtils.isNotBlank(userTO.getPassword())) {
                runtimeService.setVariable(
                        processInstance.getProcessInstanceId(), ENCRYPTED_PWD, encrypt(userTO.getPassword()));
            }
        }

        return new WorkflowResult<Map.Entry<Long, Boolean>>(
                new SimpleEntry<Long, Boolean>(user.getId(), propagateEnable), propByRes, getPerformedTasks(user));
    }
View Full Code Here

TOP

Related Classes of org.apache.syncope.core.persistence.beans.user.SyncopeUser

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.