Examples of SyncopeRole


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

        Set<String> currentResources = role.getResourceNames();

        // name
        SyncopeClientException invalidRoles = new SyncopeClientException(SyncopeClientExceptionType.InvalidRoles);
        if (roleMod.getName() != null) {
            SyncopeRole otherRole = roleDAO.find(roleMod.getName(),
                    role.getParent() == null ? null : role.getParent().getId());
            if (otherRole == null || role.equals(otherRole)) {
                if (!roleMod.getName().equals(role.getName())) {
                    propByRes.addAll(ResourceOperation.UPDATE, currentResources);
                    for (String resource : currentResources) {
View Full Code Here

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

    @Test
    public void delete() {
        Membership membership = membershipDAO.find(4L);
        SyncopeUser user = membership.getSyncopeUser();
        SyncopeRole role = membership.getSyncopeRole();

        membershipDAO.delete(4L);

        membershipDAO.flush();
View Full Code Here

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

    @Test
    public void deleteAndCreate() {
        Membership membership = membershipDAO.find(3L);
        SyncopeUser user = membership.getSyncopeUser();
        SyncopeRole role = membership.getSyncopeRole();

        // 1. delete that membership
        membershipDAO.delete(membership.getId());

        // if not flushing here, the INSERT below will be executed
View Full Code Here

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

            final SyncResultsHandler handler, final SyncDelta delta, final T subject, final K subjectMod)
            throws JobExecutionException {

        if (subject instanceof RoleTO) {
            // search for all users assigned to given role
            SyncopeRole role = roleDAO.find(subject.getId());
            if (role != null) {
                List<Membership> membs = roleDAO.findMemberships(role);
                // save memberships before role update takes place
                membersBeforeRoleUpdate = new HashMap<Long, Long>(membs.size());
                for (Membership memb : membs) {
View Full Code Here

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

    @Override
    public WorkflowResult<Long> create(final RoleTO roleTO)
            throws UnauthorizedRoleException, WorkflowException {

        SyncopeRole role = new SyncopeRole();
        dataBinder.create(role, roleTO);
        role = roleDAO.save(role);

        final PropagationByResource propByRes = new PropagationByResource();
        propByRes.set(ResourceOperation.CREATE, role.getResourceNames());

        return new WorkflowResult<Long>(role.getId(), propByRes, "create");
    }
View Full Code Here

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

    protected WorkflowResult<Long> doUpdate(final SyncopeRole role, final RoleMod roleMod)
            throws WorkflowException {

        PropagationByResource propByRes = dataBinder.update(role, roleMod);

        SyncopeRole updated = roleDAO.save(role);

        return new WorkflowResult<Long>(updated.getId(), propByRes, "update");
    }
View Full Code Here

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

    @Autowired
    private PolicyDAO policyDAO;

    @Test(expected = InvalidEntityException.class)
    public void saveWithTwoOwners() {
        SyncopeRole root = roleDAO.find("root", null);
        assertNotNull("did not find expected role", root);

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

        SyncopeRole role = new SyncopeRole();
        role.setName("error");
        role.setUserOwner(user);
        role.setRoleOwner(root);

        roleDAO.save(role);
    }
View Full Code Here

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

        roleDAO.save(role);
    }

    @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);
        assertNotNull(child1);
        assertEquals(role, child1.getParent());

        SyncopeRole child2 = roleDAO.find(10L);
        assertNotNull(child2);
        assertEquals(role, child2.getParent());

        List<SyncopeRole> ownedRoles = roleDAO.findOwned(user);
        assertFalse(ownedRoles.isEmpty());
        assertEquals(2, ownedRoles.size());
        assertTrue(ownedRoles.contains(role));
View Full Code Here

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

        assertFalse(ownedRoles.contains(child2));
    }

    public void createWithPasswordPolicy() {
        PasswordPolicy policy = (PasswordPolicy) policyDAO.find(4L);
        SyncopeRole role = new SyncopeRole();
        role.setName("roleWithPasswordPolicy");
        role.setPasswordPolicy(policy);

        SyncopeRole actual = roleDAO.save(role);
        assertNotNull(actual);

        actual = roleDAO.find(actual.getId());
        assertNotNull(actual);
        assertNotNull(actual.getPasswordPolicy());

        roleDAO.delete(actual.getId());
        assertNull(roleDAO.find(actual.getId()));

        assertNotNull(policyDAO.find(4L));
    }
View Full Code Here

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

            if (globalPP != null && globalPP.getSpecification() != null) {
                ppSpecs.add(globalPP.<PasswordPolicySpec>getSpecification());
            }

            for (MembershipTO memb : userTO.getMemberships()) {
                SyncopeRole role = roleDAO.find(memb.getRoleId());
                if (role != null && role.getPasswordPolicy() != null
                        && role.getPasswordPolicy().getSpecification() != null) {

                    ppSpecs.add(role.getPasswordPolicy().<PasswordPolicySpec>getSpecification());
                }
            }

            for (String resName : userTO.getResources()) {
                ExternalResource resource = resourceDAO.find(resName);
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.