Package org.apache.syncope.common.to

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


        userTO = createUser(userTO);
        assertTrue(userTO.getResources().contains(RESOURCE_NAME_LDAP));

        // 3. read role on resource, check that user DN is included in uniqueMember
        ConnObjectTO connObj =
                resourceService.getConnectorObject(RESOURCE_NAME_LDAP, AttributableType.ROLE, roleTO.getId());
        assertNotNull(connObj);
        assertTrue(connObj.getAttributeMap().get("uniqueMember").getValues().
                contains("uid=" + userTO.getUsername() + ",ou=people,o=isp"));

        // 4. remove membership
        UserMod userMod = new UserMod();
        userMod.setId(userTO.getId());
        userMod.addMembershipToBeRemoved(userTO.getMemberships().iterator().next().getId());

        userTO = userService.update(userMod.getId(), userMod);
        assertTrue(userTO.getResources().contains(RESOURCE_NAME_LDAP));

        // 5. read role on resource, check that user DN was removed from uniqueMember
        connObj = resourceService.getConnectorObject(RESOURCE_NAME_LDAP, AttributableType.ROLE, roleTO.getId());
        assertNotNull(connObj);
        assertFalse(connObj.getAttributeMap().get("uniqueMember").getValues().
                contains("uid=" + userTO.getUsername() + ",ou=people,o=isp"));

        // 6. restore original resource-ldap role mapping
        for (MappingItemTO item : ldap.getRmapping().getItems()) {
            if ("uniqueMember".equals(item.getExtAttrName())) {
View Full Code Here


        userTO = createUser(userTO);
        assertTrue(userTO.getResources().contains(RESOURCE_NAME_LDAP));

        // 3. read user on resource
        ConnObjectTO connObj =
                resourceService.getConnectorObject(RESOURCE_NAME_LDAP, AttributableType.USER, userTO.getId());
        assertNotNull(connObj);

        // 4. remove role
        roleService.delete(roleTO.getId());
View Full Code Here

        assertNotNull(roleTO.getPasswordPolicy());
        assertEquals(4L, (long) roleTO.getPasswordPolicy());

        assertTrue(roleTO.getResources().contains("resource-ldap"));

        ConnObjectTO connObjectTO = readConnectorObject("resource-ldap", roleTO.getId());
        assertNotNull(connObjectTO);
        assertNotNull(connObjectTO.getAttributeMap().get("owner"));
    }
View Full Code Here

    public Map<String, ConnObjectTO> getConnectorObjects(final AbstractAttributableTO attributable) {
        final Map<String, ConnObjectTO> objects = new HashMap<String, ConnObjectTO>();

        for (String resouceName : attributable.getResources()) {
            ConnObjectTO objectTO = null;
            try {
                objectTO = restClient.getConnectorObject(resouceName, attributable.getId());
            } catch (Exception e) {
                LOG.warn("ConnObject '{}' not found on resource '{}'", attributable.getId(), resouceName);
            }
View Full Code Here

     *
     * @param propTO propagation TO.
     * @return list view.
     */
    private ListView getConnObjectView(final PropagationStatusTO propTO) {
        final ConnObjectTO before = propTO.getBeforeObj();
        final ConnObjectTO after = propTO.getAfterObj();

        // sorted in reversed presentation order
        final List<String> head = new ArrayList<String>();
        if (attributable instanceof UserTO) {
            head.add(ConnIdSpecialAttributeName.PASSWORD);
            head.add(ConnIdSpecialAttributeName.ENABLE);
        }
        head.add(ConnIdSpecialAttributeName.UID);
        head.add(ConnIdSpecialAttributeName.NAME);

        final Map<String, AttributeTO> beforeAttrMap;
        if (before == null) {
            beforeAttrMap = Collections.<String, AttributeTO>emptyMap();
        } else {
            beforeAttrMap = before.getAttributeMap();
        }

        final Map<String, AttributeTO> afterAttrMap;
        if (after == null) {
            afterAttrMap = Collections.<String, AttributeTO>emptyMap();
        } else {
            afterAttrMap = after.getAttributeMap();
        }

        final Set<String> attributes = new HashSet<String>();
        attributes.addAll(beforeAttrMap.keySet());
        attributes.addAll(afterAttrMap.keySet());
View Full Code Here

        propagationRequestTO.addResource(RESOURCE_NAME_LDAP);
        userTO = userService.suspend(userId, propagationRequestTO);
        assertNotNull(userTO);
        assertEquals("suspended", userTO.getStatus());

        ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_TESTDB, userId, AttributableType.USER);
        assertFalse(getBooleanAttribute(connObjectTO, OperationalAttributes.ENABLE_NAME));

        connObjectTO = readConnectorObject(RESOURCE_NAME_LDAP, userId, AttributableType.USER);
        assertNotNull(connObjectTO);
View Full Code Here

        UserTO actual = createUser(userTO);
        assertNotNull(actual);
        assertNotNull(actual.getDerivedAttributeMap().get("csvuserid"));

        ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_CSV, actual.getId(), AttributableType.USER);
        assertNotNull(connObjectTO);
        assertEquals("sx-dx", connObjectTO.getAttributeMap().get("ROLE").getValues().get(0));
    }
View Full Code Here

        UserTO actual = createUser(userTO);
        assertNotNull(actual);
        assertNotNull(actual.getDerivedAttributeMap().get("csvuserid"));

        ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_CSV, actual.getId(), AttributableType.USER);
        assertNotNull(connObjectTO);
        assertEquals("sx-dx", connObjectTO.getAttributeMap().get("MEMBERSHIP").getValues().get(0));
    }
View Full Code Here

        UserTO actual = createUser(userTO);
        assertNotNull(actual);
        assertEquals(2, actual.getMemberships().size());
        assertEquals(1, actual.getResources().size());

        ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_CSV, actual.getId(), AttributableType.USER);
        assertNotNull(connObjectTO);

        // -----------------------------------
        // Remove the first membership: de-provisioning shouldn't happen
        // -----------------------------------
View Full Code Here

        UserTO actual = createUser(userTO);
        assertNotNull(actual);
        assertEquals(2, actual.getMemberships().size());

        ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_LDAP, actual.getId(), AttributableType.USER);
        assertNotNull(connObjectTO);

        AttributeTO postalAddress = connObjectTO.getAttributeMap().get("postalAddress");
        assertNotNull(postalAddress);
        assertEquals(1, postalAddress.getValues().size());
        assertEquals("postalAddress", postalAddress.getValues().get(0));

        AttributeTO title = connObjectTO.getAttributeMap().get("title");
        assertNotNull(title);
        assertEquals(2, title.getValues().size());
        assertTrue(title.getValues().contains("r12") && title.getValues().contains("r13"));

        // -----------------------------------
        // Remove the first membership and check for membership attr propagation and role attr propagation
        // -----------------------------------
        UserMod userMod = new UserMod();
        userMod.setId(actual.getId());

        MembershipTO membershipTO = actual.getMemberships().get(0).getRoleId() == 12L
                ? actual.getMemberships().get(0)
                : actual.getMemberships().get(1);

        userMod.addMembershipToBeRemoved(membershipTO.getId());

        actual = userService.update(userMod.getId(), userMod);
        assertNotNull(actual);
        assertEquals(1, actual.getMemberships().size());

        connObjectTO = readConnectorObject(RESOURCE_NAME_LDAP, actual.getId(), AttributableType.USER);
        assertNotNull(connObjectTO);

        postalAddress = connObjectTO.getAttributeMap().get("postalAddress");
        assertTrue(postalAddress == null || postalAddress.getValues().isEmpty()
                || StringUtils.hasText(postalAddress.getValues().get(0)));

        title = connObjectTO.getAttributeMap().get("title");
        assertNotNull(title);
        assertEquals(1, title.getValues().size());
        assertTrue(title.getValues().contains("r13"));
        // -----------------------------------
    }
View Full Code Here

TOP

Related Classes of org.apache.syncope.common.to.ConnObjectTO

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.