Package org.nasutekds.server.protocols.internal

Examples of org.nasutekds.server.protocols.internal.InternalSearchOperation


                   ResultCode.AUTHORIZATION_DENIED);
    }


    // Test a search operation against the PWReset Target user.
    InternalSearchOperation searchOperation =
         new InternalSearchOperation(conn, conn.nextOperationID(),
                  conn.nextMessageID(), controls, targetDN,
                  SearchScope.BASE_OBJECT,
                  DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false,
                  SearchFilter.createFilterFromString("(objectClass=*)"), null,
                  null);
    searchOperation.run();

    if (hasProxyPrivilege)
    {
      assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
    }
    else
    {
      assertEquals(searchOperation.getResultCode(),
                   ResultCode.AUTHORIZATION_DENIED);
    }
  }
View Full Code Here


    assertEquals(conn.hasPrivilege(Privilege.JMX_READ, null), hasPrivilege);

    ByteString dn = ByteString.valueOf("cn=config");
    LDAPFilter filter = new LDAPFilter(SearchFilter
        .createFilterFromString("(objectClass=*)"));
    InternalSearchOperation searchOperation = conn.processSearch(dn,
        SearchScope.BASE_OBJECT, filter);
    if (hasPrivilege)
    {
      assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
    }
    else
    {
      assertEquals(searchOperation.getResultCode(),
                   ResultCode.INSUFFICIENT_ACCESS_RIGHTS);
    }
  }
View Full Code Here

                   ResultCode.AUTHORIZATION_DENIED);
    }


    // Test a search operation against the PWReset Target user.
    InternalSearchOperation searchOperation =
         new InternalSearchOperation(conn, conn.nextOperationID(),
                  conn.nextMessageID(), controls, targetDN,
                  SearchScope.BASE_OBJECT,
                  DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false,
                  SearchFilter.createFilterFromString("(objectClass=*)"), null,
                  null);
    searchOperation.run();

    if (hasProxyPrivilege)
    {
      assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
    }
    else
    {
      assertEquals(searchOperation.getResultCode(),
                   ResultCode.AUTHORIZATION_DENIED);
    }
  }
View Full Code Here

      InternalClientConnection conn =
      InternalClientConnection.getRootConnection();
      LinkedHashSet<String> attrList = new LinkedHashSet<String>();
      attrList.add("ldapsyntaxes");

      InternalSearchOperation searchOperation =
           new InternalSearchOperation(
                conn,
                InternalClientConnection.nextOperationID(),
                InternalClientConnection.nextMessageID(),
                null,
                ByteString.valueOf("cn=schema"),
                SearchScope.WHOLE_SUBTREE,
                DereferencePolicy.NEVER_DEREF_ALIASES,
                Integer.MAX_VALUE,
                Integer.MAX_VALUE,
                false,
                LDAPFilter.decode("objectclass=ldapsubentry"),
                attrList, null);

      searchOperation.run();
      assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
      List<SearchResultEntry> entries = searchOperation.getSearchEntries();
      SearchResultEntry e = entries.get(0);
      //An entry must be returned.
      assertNotNull(e);
      Attribute attr = e.getAttribute("ldapsyntaxes").get(0);
      Iterator<AttributeValue> iter = attr.iterator();
View Full Code Here

                   ResultCode.AUTHORIZATION_DENIED);
    }


    // Test a search operation against the PWReset Target user.
    InternalSearchOperation searchOperation =
         new InternalSearchOperation(conn, conn.nextOperationID(),
                  conn.nextMessageID(), controls, targetDN,
                  SearchScope.BASE_OBJECT,
                  DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false,
                  SearchFilter.createFilterFromString("(objectClass=*)"), null,
                  null);
    searchOperation.run();

    if (hasProxyPrivilege)
    {
      assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
    }
    else
    {
      assertEquals(searchOperation.getResultCode(),
                   ResultCode.AUTHORIZATION_DENIED);
    }
  }
View Full Code Here

        "test-attr-regex: host:0.0.0");

      InternalClientConnection conn =
      InternalClientConnection.getRootConnection();

      InternalSearchOperation searchOperation =
           new InternalSearchOperation(
                conn,
                InternalClientConnection.nextOperationID(),
                InternalClientConnection.nextMessageID(),
                null,
                ByteString.valueOf("cn=test,o=test"),
                SearchScope.WHOLE_SUBTREE,
                DereferencePolicy.NEVER_DEREF_ALIASES,
                Integer.MAX_VALUE,
                Integer.MAX_VALUE,
                false,
                LDAPFilter.decode("test-attr-regex=host:0.0.0"),
                null, null);

      searchOperation.run();
      assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
      List<SearchResultEntry> entries = searchOperation.getSearchEntries();
      SearchResultEntry e = entries.get(0);
      //An entry must be returned.
      assertNotNull(e);
    }
    finally
View Full Code Here

        "test-attr-enum: wednesday");

      InternalClientConnection conn =
      InternalClientConnection.getRootConnection();

      InternalSearchOperation searchOperation =
           new InternalSearchOperation(
                conn,
                InternalClientConnection.nextOperationID(),
                InternalClientConnection.nextMessageID(),
                null,
                ByteString.valueOf("cn=test,o=test"),
                SearchScope.WHOLE_SUBTREE,
                DereferencePolicy.NEVER_DEREF_ALIASES,
                Integer.MAX_VALUE,
                Integer.MAX_VALUE,
                false,
                LDAPFilter.decode("test-attr-enum=wednesday"),
                null, null);

      searchOperation.run();
      assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
      List<SearchResultEntry> entries = searchOperation.getSearchEntries();
      SearchResultEntry e = entries.get(0);
      //An entry must be returned.
      assertNotNull(e);
    }
    finally
View Full Code Here

        "test-attr-enum: tuesday");

      InternalClientConnection conn =
      InternalClientConnection.getRootConnection();

      InternalSearchOperation searchOperation =
           new InternalSearchOperation(
                conn,
                InternalClientConnection.nextOperationID(),
                InternalClientConnection.nextMessageID(),
                null,
                ByteString.valueOf("o=test"),
                SearchScope.WHOLE_SUBTREE,
                DereferencePolicy.NEVER_DEREF_ALIASES,
                Integer.MAX_VALUE,
                Integer.MAX_VALUE,
                false,
                LDAPFilter.decode("test-attr-enum>=tuesday"),
                null, null);

      searchOperation.run();
      assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
      List<SearchResultEntry> entries = searchOperation.getSearchEntries();
      SearchResultEntry e = entries.get(0);
      //An entry must be returned.
      assertNotNull(e);
      assertTrue(e.getDN().equals(DN.decode("cn=test1,o=test")));
    }
View Full Code Here

    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();

    try
    {
      InternalSearchOperation searchOperation =
          new InternalSearchOperation(conn, InternalClientConnection
              .nextOperationID(), InternalClientConnection
              .nextMessageID(), null, DN.decode(ruleDN),
              SearchScope.BASE_OBJECT,
              DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false,
              SearchFilter.createFilterFromString("(objectClass=*)"),
              null, null);

      for (VirtualAttributeRule rule : DirectoryServer
          .getVirtualAttributes())
      {
        if (rule.getAttributeType().equals(descriptionType))
        {
          UserDefinedVirtualAttributeProvider provider =
              (UserDefinedVirtualAttributeProvider) rule.getProvider();

          assertFalse(provider.isMultiValued());
          assertFalse(provider.isSearchable(rule, searchOperation));

          provider.processSearch(rule, searchOperation);
          assertEquals(searchOperation.getResultCode(),
              ResultCode.UNWILLING_TO_PERFORM);
        }
      }

    }
View Full Code Here

    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();

    try
    {
      InternalSearchOperation searchOperation =
          new InternalSearchOperation(conn, InternalClientConnection
              .nextOperationID(), InternalClientConnection
              .nextMessageID(), null, DN.decode(ruleDN),
              SearchScope.BASE_OBJECT,
              DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false,
              SearchFilter.createFilterFromString("(objectClass=*)"),
              null, null);

      for (VirtualAttributeRule rule : DirectoryServer
          .getVirtualAttributes())
      {
        if (rule.getAttributeType().equals(descriptionType))
        {
          UserDefinedVirtualAttributeProvider provider =
              (UserDefinedVirtualAttributeProvider) rule.getProvider();

          assertTrue(provider.isMultiValued());
          assertFalse(provider.isSearchable(rule, searchOperation));

          provider.processSearch(rule, searchOperation);
          assertEquals(searchOperation.getResultCode(),
              ResultCode.UNWILLING_TO_PERFORM);
        }
      }
    }
    finally
View Full Code Here

TOP

Related Classes of org.nasutekds.server.protocols.internal.InternalSearchOperation

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.