Package org.apache.directory.ldap.client.api

Examples of org.apache.directory.ldap.client.api.LdapConnection.modify()


        try {
            userConnection = getNetworkConnectionAs( ldapServer, userDn.toString(), oldPassword );
            ModifyRequest modifyRequest = new ModifyRequestImpl();
            modifyRequest.setName( userDn );
            modifyRequest.replace( "userPassword", newPassword );
            return userConnection.modify( modifyRequest );
        }
        finally {
            userConnection.close();
        }
    }
View Full Code Here


        Thread.sleep( 1000 );// to avoid creating a history value with the same timestamp

        Modification modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "userPassword",
            "67891" );

        adminConnection.modify( userDn, modification );
        checkBindSuccess( userDn, "67891" );

        entry = adminConnection.lookup( userDn, "*", "+" );

        pwdHistAt = entry.get( PasswordPolicySchemaConstants.PWD_HISTORY_AT );
View Full Code Here

        Thread.sleep( 1000 );// to avoid creating a history value with the same timestamp

        modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "userPassword",
            "abcde" );

        adminConnection.modify( userDn, modification );
        checkBindSuccess( userDn, "abcde" );

        entry = adminConnection.lookup( userDn, "*", "+" );
        pwdHistAt = entry.get( PasswordPolicySchemaConstants.PWD_HISTORY_AT );
        assertNotNull( pwdHistAt );
View Full Code Here

        assertEquals( 2, pwdHistAt.size() );

        // try to reuse the password, should fail
        try
        {
            adminConnection.modify( userDn, modification );
            fail();
        }
        catch ( LdapInvalidAttributeValueException liave )
        {
            // Expected
View Full Code Here

        // Try to reuse the very first password, should succeed
        modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "userPassword",
            "12345" );

        adminConnection.modify( userDn, modification );
        checkBindSuccess( userDn, "12345" );

        adminConnection.close();
    }
View Full Code Here

    public static void enableSchema( DirectoryService service, String schemaName ) throws Exception
    {
        LdapConnection connection = getAdminConnection( service );

        // now enable the test schema
        connection.modify( "cn=" + schemaName + ",ou=schema",
            new DefaultModification(
                ModificationOperation.REPLACE_ATTRIBUTE, "m-disabled", "FALSE" ) );
    }

View Full Code Here

        // now enable the test schema
        Modification mod = new DefaultModification(
            ModificationOperation.REPLACE_ATTRIBUTE, "m-disabled", "TRUE" );

        connection.modify( "cn=" + schemaName + ",ou=schema", mod );
    }


    /**
     * A helper method which tells if a schema is disabled.
View Full Code Here

        ModifyRequest modReq = new ModifyRequestImpl();
        modReq.setName( new Dn( service.getSchemaManager(), "cn=" + groupCn + ",ou=groups,ou=system" ) );
        modReq.add( "uniqueMember", "uid=" + userUid + ",ou=users,ou=system" );

        connection.modify( modReq ).getLdapResult().getResultCode();
    }


    /**
     * Removes a user from a group.
View Full Code Here

        if ( ( administrativeRole == null ) || !administrativeRole.contains( "accessControlSpecificArea" ) )
        {
            ModifyRequest modReq = new ModifyRequestImpl();
            modReq.setName( systemEntry.getDn() );
            modReq.add( "administrativeRole", "accessControlSpecificArea" );
            connection.modify( modReq );
        }

        // now add the A/C subentry below ou=system
        Entry subEntry = new DefaultEntry(
            "cn=" + cn + ",ou=system",
View Full Code Here

        // -------------------------------------------------------------------
        // now modify entries included by the subentry to have collectiveExclusions
        // -------------------------------------------------------------------
        Modification modification = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
            new DefaultAttribute( "collectiveExclusions", "c-ou" ) );
        connection.modify( "ou=services,ou=configuration, ou=system", modification );

        // entry should not show the c-ou collective attribute anymore
        entry = connection.lookup( "ou=services,ou=configuration,ou=system" );
        c_ou = entry.get( "c-ou" );
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.