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

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


    @PreAuthorize("hasRole('ROLE_UPDATE')")
    @RequestMapping(method = RequestMethod.POST, value = "/update")
    public RoleTO update(@RequestBody final RoleMod roleMod) {
        LOG.debug("Role update called with {}", roleMod);

        SyncopeRole role = binder.getRoleFromId(roleMod.getId());

        WorkflowResult<Long> updated = rwfAdapter.update(roleMod);

        List<PropagationTask> tasks = propagationManager.getRoleUpdateTaskIds(updated,
                roleMod.getVirtualAttributesToBeRemoved(), roleMod.getVirtualAttributesToBeUpdated());

        final List<PropagationStatusTO> propagations = new ArrayList<PropagationStatusTO>();
        taskExecutor.execute(tasks, new DefaultPropagationHandler(connObjectUtil, propagations));

        final RoleTO updatedTO = binder.getRoleTO(updated.getResult());
        updatedTO.setPropagationStatusTOs(propagations);

        auditManager.audit(Category.role, RoleSubCategory.update, Result.success,
                "Successfully updated role: " + role.getId());

        LOG.debug("About to return updated role\n{}", updatedTO);

        return updatedTO;
    }
View Full Code Here


        return new GroupEntity(role.getId().toString());
    }

    private void execute() {
        if (roleId != null) {
            SyncopeRole role = roleDAO.find(roleId);
            if (role != null) {
                result = Collections.singletonList(fromSyncopeRole(role));
            } else {
                result = Collections.emptyList();
            }
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

    @PreAuthorize("hasRole('RESOURCE_READ')")
    @RequestMapping(method = RequestMethod.GET, value = "/{roleId}/mappings")
    public List<SchemaMappingTO> getRoleResourcesMapping(@PathVariable("roleId") final Long roleId)
            throws NotFoundException {

        SyncopeRole role = roleDAO.find(roleId);
        if (role == null) {
            throw new NotFoundException("Role '" + roleId + "'");
        }

        List<SchemaMappingTO> roleMappings = new ArrayList<SchemaMappingTO>();

        for (ExternalResource resource : role.getResources()) {
            roleMappings.addAll(binder.getSchemaMappingTOs(resource.getMappings()));
        }

        auditManager.audit(Category.resource, ResourceSubCategory.getRoleResourcesMapping, Result.success,
                "Found " + roleMappings.size() + " mappings for role " + roleId);
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.