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

Examples of org.apache.syncope.core.persistence.beans.role.SyncopeRole


            throws SyncopeClientCompositeErrorException {

        SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);

        // memberships
        SyncopeRole role;
        for (MembershipTO membershipTO : userTO.getMemberships()) {
            role = roleDAO.find(membershipTO.getRoleId());

            if (role == null) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Ignoring invalid role " + membershipTO.getRoleName());
                }
            } else {
                Membership membership = null;
                if (user.getId() != null) {
                    membership = user.getMembership(role.getId()) == null
                            ? membershipDAO.find(user, role)
                            : user.getMembership(role.getId());
                }
                if (membership == null) {
                    membership = new Membership();
                    membership.setSyncopeRole(role);
                    membership.setSyncopeUser(user);
View Full Code Here


        // memberships to be added
        for (MembershipMod membershipMod : userMod.getMembershipsToBeAdded()) {
            LOG.debug("Membership to be added: role({})", membershipMod.getRole());

            SyncopeRole role = roleDAO.find(membershipMod.getRole());
            if (role == null) {
                LOG.debug("Ignoring invalid role {}", membershipMod.getRole());
            } else {
                membership = user.getMembership(role.getId());
                if (membership == null) {
                    membership = new Membership();
                    membership.setSyncopeRole(role);
                    membership.setSyncopeUser(user);

                    user.addMembership(membership);

                    toBeProvisioned.addAll(role.getResourceNames());
                }

                propByRes.merge(fill(membership, membershipMod,
                        AttributableUtil.getInstance(AttributableType.MEMBERSHIP), scce));
            }
View Full Code Here

        assertEquals(2, roleDAO.findChildren(4L).size());
    }

    @Test
    public void find() {
        SyncopeRole role = roleDAO.find("root", null);
        assertNotNull("did not find expected role", role);
        role = roleDAO.find(null, null);
        assertNull("found role but did not expect it", role);
    }
View Full Code Here

        assertNull("found role but did not expect it", role);
    }

    @Test
    public void inheritedAttributes() {
        SyncopeRole director = roleDAO.find(7L);

        assertEquals(1, director.findInheritedAttributes().size());
    }
View Full Code Here

        assertEquals(1, director.findInheritedAttributes().size());
    }

    @Test
    public void inheritedDerivedAttributes() {
        SyncopeRole director = roleDAO.find(7L);

        assertEquals(1, director.findInheritedDerivedAttributes().size());
    }
View Full Code Here

        assertEquals(1, director.findInheritedDerivedAttributes().size());
    }

    @Test
    public void inheritedVirtualAttributes() {
        SyncopeRole director = roleDAO.find(7L);

        assertEquals(1, director.findInheritedVirtualAttributes().size());
    }
View Full Code Here

        assertEquals(1, director.findInheritedVirtualAttributes().size());
    }

    @Test
    public void inheritedPolicy() {
        SyncopeRole role = roleDAO.find(7L);

        assertNotNull(role);

        assertNotNull(role.getAccountPolicy());
        assertNotNull(role.getPasswordPolicy());

        assertEquals(Long.valueOf(4), role.getPasswordPolicy().getId());

        role = roleDAO.find(5L);

        assertNotNull(role);

        assertNull(role.getAccountPolicy());
        assertNull(role.getPasswordPolicy());
    }
View Full Code Here

        assertNull(role.getPasswordPolicy());
    }

    @Test
    public void save() {
        SyncopeRole role = new SyncopeRole();
        role.setName("secondChild");

        // verify inheritance password and account policies
        role.setInheritAccountPolicy(false);
        // not inherited so setter execution shouldn't be ignored
        role.setAccountPolicy((AccountPolicy) policyDAO.find(6L));

        role.setInheritPasswordPolicy(true);
        // inherited so setter execution should be ignored
        role.setPasswordPolicy((PasswordPolicy) policyDAO.find(4L));

        SyncopeRole rootRole = roleDAO.find("root", null);
        role.setParent(rootRole);

        role = roleDAO.save(role);

        SyncopeRole actual = roleDAO.find(role.getId());
        assertNotNull("expected save to work", actual);

        assertNull(role.getPasswordPolicy());
        assertNotNull(role.getAccountPolicy());
        assertEquals(Long.valueOf(6), role.getAccountPolicy().getId());
View Full Code Here

        assertEquals(Long.valueOf(6), role.getAccountPolicy().getId());
    }

    @Test
    public void delete() {
        SyncopeRole role = roleDAO.find(4L);
        roleDAO.delete(role.getId());

        SyncopeRole actual = roleDAO.find(4L);
        assertNull("delete did not work", actual);

        SyncopeRole children = roleDAO.find(7L);
        assertNull("delete of successors did not work", children);
    }
View Full Code Here

                break;

            case RoleOwnerSchema:
                for (AbstractAttributable attributable : attributables) {
                    if (attributable instanceof SyncopeRole) {
                        SyncopeRole role = (SyncopeRole) attributable;
                        String roleOwnerValue = null;
                        if (role.getUserOwner() != null && resource.getUmapping() != null) {
                            roleOwnerValue = getRoleOwnerValue(resource, role.getUserOwner());
                        }
                        if (role.getRoleOwner() != null && resource.getRmapping() != null) {
                            roleOwnerValue = getRoleOwnerValue(resource, role.getRoleOwner());
                        }

                        if (StringUtils.isNotBlank(roleOwnerValue)) {
                            attrValue = new RAttrValue();
                            attrValue.setStringValue(roleOwnerValue);
View Full Code Here

TOP

Related Classes of org.apache.syncope.core.persistence.beans.role.SyncopeRole

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.