Examples of ModifyRequestImpl


Examples of org.apache.directory.api.ldap.model.message.ModifyRequestImpl

        {
            LOG.debug( "received a null entry for modification" );
            throw new IllegalArgumentException( "Entry to be modified cannot be null" );
        }

        ModifyRequest modReq = new ModifyRequestImpl();
        modReq.setName( entry.getDn() );

        Iterator<Attribute> itr = entry.iterator();

        while ( itr.hasNext() )
        {
            modReq.addModification( itr.next(), modOp );
        }

        ModifyResponse modifyResponse = modify( modReq );

        processResponse( modifyResponse );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.ModifyRequestImpl

            String msg = "Cannot process a ModifyRequest without any modification";
            LOG.debug( msg );
            throw new IllegalArgumentException( msg );
        }

        ModifyRequest modReq = new ModifyRequestImpl();
        modReq.setName( dn );

        for ( Modification modification : modifications )
        {
            modReq.addModification( modification );
        }

        ModifyResponse modifyResponse = modify( modReq );

        processResponse( modifyResponse );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.ModifyRequestImpl

    @Test
    public void testIllegalModification() throws Exception
    {
        LdapConnection con = getAdminConnection( getLdapServer() );

        ModifyRequest modReq = new ModifyRequestImpl();
        modReq.setName( new Dn( DN ) );
        modReq.add( "description", "" );

        ModifyResponse resp = con.modify( modReq );
        assertEquals( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, resp.getLdapResult().getResultCode() );

        // Check whether entry is unmodified, i.e. no description
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.ModifyRequestImpl

    @Test
    public void testIllegalModification() throws Exception
    {
        LdapConnection con = getAdminConnection( getLdapServer() );

        ModifyRequest modReq = new ModifyRequestImpl();
        modReq.setName( new Dn( DN ) );
        modReq.add( "description", "" );

        ModifyResponse resp = con.modify( modReq );
        assertEquals( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, resp.getLdapResult().getResultCode() );

        // Check whether entry is unmodified, i.e. no description
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.ModifyRequestImpl

            PasswordPolicy respCtrl = getPwdRespCtrl( bindResponse );
            assertNotNull( respCtrl );
            assertNull( respCtrl.getResponse() );

            // now modify change time
            ModifyRequest modifyRequest = new ModifyRequestImpl();
            modifyRequest.setName( userDn );
            modifyRequest.replace( "pwdChangedTime", DateUtils.getGeneralizedTime( new Date().getTime() - 3100000 ) );
            adminConnection.modify( modifyRequest );

            BindRequest bindReq2 = new BindRequestImpl();
            bindReq2.setDn( userDn );
            bindReq2.setCredentials( "12345" );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.ModifyRequestImpl

       BindResponse bindResponse = userConnection.bind( bindRequest );
       assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
       assertEquals( PasswordPolicyErrorEnum.CHANGE_AFTER_RESET,
           getPwdRespCtrl( bindResponse ).getResponse().getPasswordPolicyError() );

       ModifyRequest modifyRequest = new ModifyRequestImpl();
       modifyRequest.setName( userDn );
       modifyRequest.replace( "userPassword", "123456" );
       modifyRequest.addControl( PP_REQ_CTRL );
       // succeed because admin previously set password
       ModifyResponse modifyResponse = userConnection.modify( modifyRequest );
       assertEquals( ResultCodeEnum.SUCCESS, modifyResponse.getLdapResult().getResultCode() );

       modifyRequest = new ModifyRequestImpl();
       modifyRequest.setName( userDn );
       modifyRequest.replace( "userPassword", "1234567" );
       modifyRequest.addControl( PP_REQ_CTRL );
       // fail cause password is too young
       modifyResponse = userConnection.modify( modifyRequest );
       assertEquals( ResultCodeEnum.CONSTRAINT_VIOLATION,
           modifyResponse.getLdapResult().getResultCode() );
       assertEquals( PasswordPolicyErrorEnum.PASSWORD_TOO_YOUNG,
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.ModifyRequestImpl

     */
    public static void addUserToGroup( String userUid, String groupCn ) throws Exception
    {
        LdapConnection connection = getAdminConnection();

        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();
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.ModifyRequestImpl

     * @param groupCn the Rdn attribute value of the group to have user removed from
     * @throws Exception if there are problems accessing the group
     */
    public static void removeUserFromGroup( String userUid, String groupCn ) throws Exception
    {
        ModifyRequest modReq = new ModifyRequestImpl();
        modReq.setName( new Dn( "cn=" + groupCn + ",ou=groups,ou=system" ) );
        modReq.remove( "uniqueMember", "uid=" + userUid + ",ou=users,ou=system" );
        getAdminConnection().modify( modReq );
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.ModifyRequestImpl

        // modify ou=system to be an AP for an A/C AA if it is not already
        Attribute administrativeRole = systemEntry.get( "administrativeRole" );

        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(
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.ModifyRequestImpl

     * @throws Exception if there is a problem adding the attribute
     */
    public static void addEntryACI( Dn dn, String aciItem ) throws Exception
    {
        // modify the entry relative to ou=system to include the aciItem
        ModifyRequest modReq = new ModifyRequestImpl();
        modReq.setName( dn );
        modReq.add( "entryACI", aciItem );

        getAdminConnection().modify( modReq );
    }
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.