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

Examples of org.apache.syncope.core.persistence.beans.Policy


        // set password
        int passwordHistorySize = 0;

        try {
            Policy policy = policyDAO.getGlobalPasswordPolicy();
            PasswordPolicySpec passwordPolicy = policy.getSpecification();
            passwordHistorySize = passwordPolicy.getHistoryLength();
        } catch (Exception ignore) {
            // ignore exceptions
        }
View Full Code Here


        // password
        if (userMod.getPassword() != null) {
            int passwordHistorySize = 0;
            try {
                Policy policy = policyDAO.getGlobalPasswordPolicy();
                PasswordPolicySpec passwordPolicy = policy.getSpecification();
                passwordHistorySize = passwordPolicy.getHistoryLength();
            } catch (Exception ignore) {
                // ignore exceptions
            }
View Full Code Here

    @PreAuthorize("hasRole('POLICY_UPDATE')")
    @RequestMapping(method = RequestMethod.POST, value = "/password/update")
    public PasswordPolicyTO update(@RequestBody final PasswordPolicyTO policyTO)
            throws NotFoundException {

        Policy policy = policyDAO.find(policyTO.getId());
        if (!(policy instanceof PasswordPolicy)) {
            throw new NotFoundException("PasswordPolicy with id " + policyTO.getId());
        }

        return update(policyTO, policy);
View Full Code Here

    @PreAuthorize("hasRole('POLICY_UPDATE')")
    @RequestMapping(method = RequestMethod.POST, value = "/account/update")
    public AccountPolicyTO update(@RequestBody final AccountPolicyTO policyTO)
            throws NotFoundException, SyncopeClientCompositeErrorException {

        Policy policy = policyDAO.find(policyTO.getId());
        if (!(policy instanceof AccountPolicy)) {
            throw new NotFoundException("AccountPolicy with id " + policyTO.getId());
        }

        return update(policyTO, policy);
View Full Code Here

    @PreAuthorize("hasRole('POLICY_UPDATE')")
    @RequestMapping(method = RequestMethod.POST, value = "/sync/update")
    public SyncPolicyTO update(@RequestBody final SyncPolicyTO policyTO)
            throws NotFoundException, SyncopeClientCompositeErrorException {

        Policy policy = policyDAO.find(policyTO.getId());
        if (!(policy instanceof SyncPolicy)) {
            throw new NotFoundException("SyncPolicy with id " + policyTO.getId());
        }

        return update(policyTO, policy);
View Full Code Here

    public PolicyTO read(@PathVariable("id") final Long id)
            throws NotFoundException {

        LOG.debug("Reading policy with id {}", id);

        Policy policy = policyDAO.find(id);
        if (policy == null) {
            throw new NotFoundException("Policy " + id + " not found");
        }

        auditManager.audit(Category.policy, PolicySubCategory.read, Result.success,
                "Successfully read policy (" + policy.getType() + "): " + policy.getId());

        return binder.getPolicyTO(policy);
    }
View Full Code Here

    @PreAuthorize("hasRole('POLICY_DELETE')")
    @RequestMapping(method = RequestMethod.GET, value = "/delete/{id}")
    public PolicyTO delete(@PathVariable("id") final Long id) throws NotFoundException {

        LOG.debug("Delete policy");
        Policy policy = policyDAO.find(id);
        if (policy == null) {
            throw new NotFoundException("Policy " + id + " not found");
        }
        PolicyTO policyToDelete = binder.getPolicyTO(policy);
        policyDAO.delete(id);
View Full Code Here

        assertFalse(policies.isEmpty());
    }

    @Test
    public void findById() {
        Policy policy = policyDAO.find(1L);
        assertNotNull("findById did not work", policy);
    }
View Full Code Here

    public void update() {
        PasswordPolicySpec specification = new PasswordPolicySpec();
        specification.setMaxLength(8);
        specification.setMinLength(6);

        Policy policy = policyDAO.getGlobalPasswordPolicy();
        assertNotNull(policy);
        policy.setSpecification(specification);

        policy = policyDAO.save(policy);

        assertNotNull(policy);
        assertEquals(PolicyType.GLOBAL_PASSWORD, policy.getType());
        assertEquals(((PasswordPolicySpec) policy.getSpecification()).getMaxLength(), 8);
        assertEquals(((PasswordPolicySpec) policy.getSpecification()).getMinLength(), 6);
    }
View Full Code Here

        assertEquals(((PasswordPolicySpec) policy.getSpecification()).getMinLength(), 6);
    }

    @Test
    public void delete() {
        Policy policy = policyDAO.find(1L);
        assertNotNull("find to delete did not work", policy);

        policyDAO.delete(policy.getId());

        Policy actual = policyDAO.find(1L);
        assertNull("delete did not work", actual);
    }
View Full Code Here

TOP

Related Classes of org.apache.syncope.core.persistence.beans.Policy

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.