Package org.apache.directory.shared.ldap.name

Examples of org.apache.directory.shared.ldap.name.DN


    {
        Name[] childRdns = new Name[children.length];
       
        for ( int i = 0; ( i < children.length ) && ( count[0] < sizeLimit ); i++ )
        {
            Name childRdn = new DN();
            childRdn.addAll( parent );
            childRdn.add( "ou=" + i );
            childRdns[i] = childRdn;
            getSystemContext( service ).createSubcontext( childRdn, children[i] );
            count[0]++;
        }
View Full Code Here


        NamingEnumeration<SearchResult> results = sysRoot.search( rdn, "(objectClass=*)", new SearchControls() );
       
        while ( results.hasMore() )
        {
            SearchResult result = results.next();
            Name childRdn = new DN( result.getName() );
            childRdn.remove( 0 );
            recursivelyDelete( childRdn );
        }
        sysRoot.destroySubcontext( rdn );
    }
View Full Code Here

        if ( cons == null )
        {
            cons = new SearchControls();
        }

        Name base = addSearchData( new DN(), 3, 10 );
        Name userDn = new DN( "uid=" + uid + ",ou=users,ou=system" );
        try
        {
            results.clear();
            DirContext userCtx = getContextAs( userDn, password );
            NamingEnumeration<SearchResult> list = userCtx.search( base, filter, cons );
View Full Code Here

        if ( cons == null )
        {
            cons = new SearchControls();
        }

        Name base = addSearchData( new DN(), 3, 10 );
        addEntryACI( rdn, aci );
        Name userDn = new DN( "uid=" + uid + ",ou=users,ou=system" );
        try
        {
            results.clear();
            DirContext userCtx = getContextAs( userDn, password );
            NamingEnumeration<SearchResult> list = userCtx.search( base, "(objectClass=*)", cons );
View Full Code Here

     */
    @Test
    public void testAddSearchData() throws Exception
    {
        LdapContext sysRoot = getSystemContext( service );
        Name base = addSearchData( new DN(), 3, 10 );
        SearchControls controls = new SearchControls();
        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
        NamingEnumeration<SearchResult> results = sysRoot.search( base, "(objectClass=*)", controls );
        int counter = 0;
       
View Full Code Here

            + "grantsAndDenials { denyRead, denyReturnDN, denyBrowse } } } } }";

        // try a search operation which should fail without any prescriptive ACI
        SearchControls cons = new SearchControls();
        cons.setSearchScope( SearchControls.SUBTREE_SCOPE );
        DN rdn = new DN( "ou=tests" );
        assertFalse( checkSearchAsWithEntryACI( "billyd", "billyd", cons, rdn, aci, 9 ) );

        // now add a subentry that enables anyone to search below ou=system
        createAccessControlSubentry( "anybodySearch", "{ " + "identificationTag \"searchAci\", " + "precedence 14, "
            + "authenticationLevel none, " + "itemOrUserFirst userFirst: { " + "userClasses { allUsers }, "
View Full Code Here

            + "grantsAndDenials { denyRead, denyReturnDN, denyBrowse } } } } }";

        // try a search operation which should fail without any prescriptive ACI
        SearchControls cons = new SearchControls();
        cons.setSearchScope( SearchControls.SUBTREE_SCOPE );
        DN rdn = new DN( "ou=tests" );
        assertFalse( checkSearchAsWithEntryACI( "billyd", "billyd", cons, rdn, aci, 9 ) );

        // now add a subentry that enables anyone to search below ou=system
        createAccessControlSubentry( "anybodySearch", "{ " + "identificationTag \"searchAci\", " + "precedence 15, "
            + "authenticationLevel none, " + "itemOrUserFirst userFirst: { " + "userClasses { allUsers }, "
View Full Code Here

     * @return the single search result if access is allowed or null
     * @throws NamingException if the search fails w/ exception other than no permission
     */
    private SearchResult checkCanSearhSubentryAs( String uid, String password, Name rdn ) throws Exception
    {
        DirContext userCtx = getContextAs( new DN( "uid=" + uid + ",ou=users,ou=system" ), password );
        SearchControls cons = new SearchControls();
        cons.setSearchScope( SearchControls.OBJECT_SCOPE );
        SearchResult result = null;
        NamingEnumeration<SearchResult> list = null;

View Full Code Here

            + "authenticationLevel none, " + "itemOrUserFirst userFirst: { " + "userClasses { allUsers }, "
            + "userPermissions { { " + "protectedItems {entry, allUserAttributeTypesAndValues}, "
            + "grantsAndDenials { grantRead, grantReturnDN, grantBrowse } } } } }" );

        // check and see if we can access the subentry now
        assertNotNull( checkCanSearhSubentryAs( "billyd", "billyd", new DN( "cn=anybodySearch" ) ) );

        // now add a denial to prevent all users except the admin from accessing the subentry
        addSubentryACI( "{ " + "identificationTag \"searchAci\", " + "precedence 14, " + "authenticationLevel none, "
            + "itemOrUserFirst userFirst: { " + "userClasses { allUsers }, " + "userPermissions { { "
            + "protectedItems {entry, allUserAttributeTypesAndValues}, "
            + "grantsAndDenials { denyRead, denyReturnDN, denyBrowse } } } } }" );

        // now we should not be able to access the subentry with a search
        assertNull( checkCanSearhSubentryAs( "billyd", "billyd", new DN( "cn=anybodySearch" ) ) );
    }
View Full Code Here

                + "itemOrUserFirst userFirst: { " + "userClasses { allUsers }, " + "userPermissions { { "
                + "protectedItems {entry, allUserAttributeTypesAndValues}, "
                + "grantsAndDenials { grantRead, grantReturnDN, grantBrowse, grantDiscloseOnError } } } } }" );

        // get a context as the user and try a lookup of a non-existant entry under ou=groups,ou=system
        DirContext userCtx = getContextAs( new DN( "uid=billyd,ou=users,ou=system" ), "billyd" );
        try
        {
            userCtx.lookup( "cn=blah,ou=groups" );
        }
        catch ( NamingException e )
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.name.DN

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.