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

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


    @Test
    public void findByOwner() {
        SyncopeRole role = roleDAO.find(6L);
        assertNotNull("did not find expected role", role);

        SyncopeUser user = userDAO.find(5L);
        assertNotNull("did not find expected user", user);

        assertEquals(user, role.getUserOwner());

        SyncopeRole child1 = roleDAO.find(7L);
View Full Code Here


        userMod.addMembershipToBeRemoved(userTO.getMemberships().iterator().next().getId());

        userTO = userService.update(userMod.getId(), userMod);
        assertNotNull(userTO);

        SyncopeUser passwordTestUser = new SyncopeUser();
        passwordTestUser.setPassword("new2Password", CipherAlgorithm.SHA1, 0);
        assertEquals(passwordTestUser.getPassword(), userTO.getPassword());

        assertEquals(1, userTO.getMemberships().size());
        assertEquals(1, userTO.getMemberships().iterator().next().getAttributes().size());
        assertFalse(userTO.getDerivedAttributes().isEmpty());
View Full Code Here

        userTO = userService.update(userMod.getId(), userMod);

        // check for changePwdDate
        assertNotNull(userTO.getChangePwdDate());

        SyncopeUser passwordTestUser = new SyncopeUser();
        passwordTestUser.setPassword("newPassword123", CipherAlgorithm.SHA1, 0);
        assertEquals(passwordTestUser.getPassword(), userTO.getPassword());

        List<PropagationTaskTO> afterTasks = (List<PropagationTaskTO>) taskService.list(TaskType.PROPAGATION);
        assertNotNull(afterTasks);
        assertFalse(afterTasks.isEmpty());
View Full Code Here

        final AbstractAttributableTO updated = getAttributableTOFromConnObject(obj, syncTask, attrUtil);
        updated.setId(id);

        if (AttributableType.USER == attrUtil.getType()) {
            // update password if and only if password is really changed
            final SyncopeUser user = userDataBinder.getUserFromId(id);
            if (StringUtils.isBlank(((UserTO) updated).getPassword())
                    || userDataBinder.verifyPassword(user, ((UserTO) updated).getPassword())) {

                ((UserTO) updated).setPassword(null);
            }

            for (MembershipTO membTO : ((UserTO) updated).getMemberships()) {
                Membership memb = user.getMembership(membTO.getRoleId());
                if (memb != null) {
                    membTO.setId(memb.getId());
                }
            }
View Full Code Here

                    LOG.error("Could not search for matching subjects", e);
                }
                break;

            case Username:
                SyncopeUser user = userDAO.find(uid);
                if (user != null) {
                    result.add(user.getId());
                }
                break;

            case UserId:
                user = userDAO.find(Long.parseLong(uid));
                if (user != null) {
                    result.add(user.getId());
                }
                break;

            case RoleName:
                List<SyncopeRole> roles = roleDAO.find(uid);
View Full Code Here

                    new HashSet<String>());
        }

        Boolean enabled = readEnabled(delta.getObject());
        if (enabled != null) {
            SyncopeUser user = userDAO.find(id);

            WorkflowResult<Long> enableUpdate = null;
            if (user.isSuspended() == null) {
                enableUpdate = uwfAdapter.activate(id, null);
            } else if (enabled && user.isSuspended()) {
                enableUpdate = uwfAdapter.reactivate(id);
            } else if (!enabled && !user.isSuspended()) {
                enableUpdate = uwfAdapter.suspend(id);
            }

            if (enableUpdate != null) {
                if (enableUpdate.getPropByRes() != null) {
View Full Code Here

                    LOG.error("Could not search for matching subjects", e);
                }
                break;

            case Username:
                SyncopeUser user = userDAO.find(uid);
                if (user != null) {
                    result.add(user.getId());
                }
                break;

            case UserId:
                user = userDAO.find(Long.parseLong(uid));
                if (user != null) {
                    result.add(user.getId());
                }
                break;

            case RoleName:
                List<SyncopeRole> roles = roleDAO.find(uid);
View Full Code Here

                    new HashSet<String>());
        }

        Boolean enabled = readEnabled(delta.getObject());
        if (enabled != null) {
            SyncopeUser user = userDAO.find(id);

            WorkflowResult<Long> enableUpdate = null;
            if (user.isSuspended() == null) {
                enableUpdate = uwfAdapter.activate(id, null);
            } else if (enabled && user.isSuspended()) {
                enableUpdate = uwfAdapter.reactivate(id);
            } else if (!enabled && !user.isSuspended()) {
                enableUpdate = uwfAdapter.suspend(id);
            }

            if (enableUpdate != null) {
                if (enableUpdate.getPropByRes() != null) {
View Full Code Here

        if (mapItem.isAccountid()) {
            result = new AbstractMap.SimpleEntry<String, Attribute>(objValues.iterator().next().toString(), null);
        } else if (mapItem.isPassword() && subject instanceof SyncopeUser) {
            String passwordAttrValue = password;
            if (StringUtils.isBlank(passwordAttrValue)) {
                SyncopeUser user = (SyncopeUser) subject;
                if (user.canDecodePassword()) {
                    try {
                        passwordAttrValue = PasswordEncoder.decode(user.getPassword(), user.getCipherAlgorithm());
                    } catch (Exception e) {
                        LOG.error("Could not decode password for {}", user, e);
                    }
                } else if (resource.isRandomPwdIfNotProvided()) {
                    try {
View Full Code Here

        super.before(task, beforeObj);

        if (ResourceOperation.DELETE != task.getPropagationOperation()
                && AttributableType.USER == task.getSubjectType() && task.getResource().getRmapping() != null) {

            SyncopeUser user = userDAO.find(task.getSubjectId());
            if (user == null) {
                throw new IllegalArgumentException("User " + task.getSubjectId() + " not found");
            }

            List<String> roleAccountLinks = new ArrayList<String>();
            for (SyncopeRole role : user.getRoles()) {
                if (role.getResourceNames().contains(task.getResource().getName())
                        && StringUtils.isNotBlank(task.getResource().getRmapping().getAccountLink())) {

                    LOG.debug("Evaluating accountLink for {}", role);
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.