Package org.apache.directory.api.ldap.model.entry

Examples of org.apache.directory.api.ldap.model.entry.Entry


        count = loader.execute();
   
        // Try to modify the entry with the created user
        LdapConnection cnx = getConnectionAs( "uid=READER ,ou=users,ou=system", "secret" );
   
        Entry res = cnx.lookup( "uid=READER ,ou=users,ou=system" );
   
        assertNotNull( res );
   
        try
        {
View Full Code Here


            "userPassword" );
        int counter = 0;
   
        while ( cursor.next() )
        {
            Entry result = cursor.get();
            results.put( result.getDn().getName(), result );
            counter++;
        }
   
        cursor.close();
   
        assertEquals( 0, counter );
   
        // now add a subentry that enables anyone to search an entry below ou=system
        createAccessControlSubentry( "protectUserPassword",
            "{" +
                "  identificationTag \"protectUserPassword\"," +
                "  precedence 14," +
                "  authenticationLevel none," +
                "  itemOrUserFirst itemFirst: " +
                "  {" +
                "    protectedItems " +
                "    {" +
                "      allAttributeValues { userPassword }" +
                "    }," +
                "    itemPermissions " +
                "    {" +
                "      {" +
                "        userClasses " +
                "        {" +
                "          allUsers " +
                "        }," +
                "        grantsAndDenials { denyBrowse }" +
                "      }," +
                "      {" +
                "        userClasses " +
                "        {" +
                "          thisEntry " +
                "        }," +
                "        grantsAndDenials { grantBrowse }" +
                "      }" +
                "    }" +
                "  }" +
                "}" );
   
        // see if we can now search that tree which we could not before
        // should work now with billyd now that all users are authorized
        userCtx = getConnectionAs( "uid=billyd,ou=users,ou=system", "billyd" );
        cursor = userCtx.search( "ou=users,ou=system", "(ObjectClass=*)", SearchScope.SUBTREE,
            "userPassword" );
        counter = 0;
   
        while ( cursor.next() )
        {
            Entry result = cursor.get();
            results.put( result.getDn().getName(), result );
            counter++;
        }
   
        cursor.close();
    }
View Full Code Here

    @Test
    public void testRename() throws Exception
    {
        connection.rename( DN, "cn=modifyDnWithString" );
        Entry entry = session.lookup( new Dn( "cn=modifyDnWithString,ou=system" ), "*" );
        assertTrue( session.exists( new Dn( "cn=modifyDnWithString,ou=system" ) ) );
        assertTrue( entry.contains( "cn", "modifyDnWithString" ) );
        assertFalse( entry.contains( "cn", "modDn" ) );
    }
View Full Code Here

        connection.rename( DN, "cn=modifyDnWithString", false );

        Dn oldDn = new Dn( DN );
        assertFalse( session.exists( oldDn ) );

        Entry entry = session.lookup( new Dn( "cn=modifyDnWithString,ou=system" ) );
        assertNotNull( entry );

        Rdn oldRdn = oldDn.getRdn();
        assertTrue( entry.contains( oldRdn.getType(), oldRdn.getNormValue() ) );
    }
View Full Code Here

    @Test
    public void testMoveAndRename() throws Exception
    {
        Dn origDn = new Dn( "cn=testadd,ou=users,ou=system" );
        Entry entry = new DefaultEntry( origDn );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC );
        entry.add( SchemaConstants.CN_AT, "testadd" );
        entry.add( SchemaConstants.SN_AT, "testadd_sn" );

        connection.add( entry );

        Dn newDn = new Dn( "cn=testaddMovedAndRenamed,ou=system" );
        connection.moveAndRename( origDn, newDn );

        assertFalse( session.exists( origDn ) );

        entry = session.lookup( newDn, "+" );

        assertTrue( entry.containsAttribute( SchemaConstants.MODIFIERS_NAME_AT ) );
        assertTrue( entry.containsAttribute( SchemaConstants.MODIFY_TIMESTAMP_AT ) );
    }
View Full Code Here

    {
        Dn newDn = new Dn( "cn=modifiedDn", DN_CONTAINER );
        connection.moveAndRename( new Dn( DN ), newDn );

        assertTrue( session.exists( newDn ) );
        Entry entry = session.lookup( newDn, "*" );
        assertTrue( entry.contains( "cn", "modifiedDn" ) );
        assertFalse( entry.contains( "cn", "modDn" ) );
    }
View Full Code Here

    {
        Dn newDn = new Dn( "cn=modifiedDn", DN_CONTAINER );
        connection.moveAndRename( new Dn( DN ), newDn, true );

        assertTrue( session.exists( newDn ) );
        Entry entry = session.lookup( newDn, "*" );
        assertTrue( entry.contains( "cn", "modifiedDn" ) );
        assertFalse( entry.contains( "cn", "modDn" ) );
    }
View Full Code Here

    {
        Dn newDn = new Dn( "cn=modifiedDn", DN_CONTAINER );
        connection.moveAndRename( new Dn( DN ), newDn, false );

        assertTrue( session.exists( newDn ) );
        Entry entry = session.lookup( newDn, "*" );
        assertTrue( entry.contains( "cn", "modifiedDn" ) );
        assertTrue( entry.contains( "cn", "modDn" ) );
    }
View Full Code Here

    public void testSearchCore100kUsers() throws Exception
    {
        LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
        connection.bind( "uid=admin,ou=system", "secret" );

        Entry rootPeople = new DefaultEntry(
            connection.getSchemaManager(),
            "ou=People,dc=example,dc=com",
            "objectClass: top",
            "objectClass: organizationalUnit",
            "ou: People" );

        connection.add( rootPeople );
        int nbUsers = 10000;
       
        System.out.println( "Sleeping..." );
        //Thread.sleep( 10000 );

        long tadd0 = System.currentTimeMillis();
        long tadd = tadd0;

        for ( int i = 0; i < nbUsers; i++ )
        {
            Entry user = new DefaultEntry(
                connection.getSchemaManager(),
                "uid=user." + i + ",ou=People,dc=example,dc=com",
                "objectClass: top",
                "objectClass: person",
                "objectClass: organizationalPerson",
View Full Code Here

       
        getService().getAdminSession().add(
            new DefaultEntry( getService().getSchemaManager(), akarasulu.getEntry() ) );
       
        // Read the entry we just created using the akarasuluSession
        Entry readEntry = getService().getAdminSession().lookup( akarasulu.getDn(), new String[]{ "userPassword"} );
       
        assertTrue( Arrays.equals( akarasulu.get( "userPassword" ).getBytes(), readEntry.get( "userPassword" ).getBytes() ) );

        Attribute attribute = new DefaultAttribute( "userPassword", "replaced" );

        Modification mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
     
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.entry.Entry

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.