Package com.google.enterprise.connector.spi

Examples of com.google.enterprise.connector.spi.Principal


  /**
   * Tests that case-insensitivity is written to the feed correctly.
   */
  public void testCaseInsensitivePrincipal() throws Exception {
    testPrincipal(
        new Principal(SpiConstants.PrincipalType.UNKNOWN, null, "John Doe",
            SpiConstants.CaseSensitivityType.EVERYTHING_CASE_INSENSITIVE),
        "<principal case-sensitivity-type=\"everything-case-insensitive\""
        + " scope=\"user\" access=\"permit\">John Doe</principal>");
  }
View Full Code Here


          XmlUtils.xmlAppendEndTag(ServletUtil.XMLTAG_IDENTITY, out);

          // Add any returned groups that the user may belong to.
          if (response.getGroups() != null) {
            for (Object item : response.getGroups()) {
              Principal group = (item instanceof String) ?
                  new Principal((String) item) : (Principal) item;
              out.append(ServletUtil.indentStr(3));
              out.append('<').append(ServletUtil.XMLTAG_GROUP);
              if (group.getPrincipalType() ==
                  SpiConstants.PrincipalType.UNQUALIFIED) {
                // UNQUALIFIED is a special-case on the GSA to allow us to
                // prevent the GSA from mistakeningly finding a domain in the
                // principal name.
                XmlUtils.xmlAppendAttr(
                    ServletUtil.XMLTAG_PRINCIPALTYPE_ATTRIBUTE,
                    SpiConstants.PrincipalType.UNQUALIFIED.toString(), out);
              }
              if (!Strings.isNullOrEmpty(group.getNamespace())) {
                XmlUtils.xmlAppendAttr(ServletUtil.XMLTAG_NAMESPACE_ATTRIBUTE,
                    group.getNamespace(), out);
              }
              out.append('>');
              XmlUtils.xmlAppendAttrValue(group.getName(), out);
              XmlUtils.xmlAppendEndTag(ServletUtil.XMLTAG_GROUP, out);
            }
          }
          ServletUtil.writeXMLTag(out, 2, ServletUtil.XMLTAG_SUCCESS, true);
        } else {
View Full Code Here

    props.put(SpiConstants.PROPNAME_DOCID, docId);
    props.put(SpiConstants.PROPNAME_MIMETYPE, "text/plain");
    props.put(SpiConstants.PROPNAME_CONTENT, "now is the time");
    props.put(SpiConstants.PROPNAME_DISPLAYURL,
        "http://www.comtesturl.com/test?" + docId);
    props.put(SpiConstants.PROPNAME_ACLGROUPS, new Principal("Everyone"));
    return props;
  }
View Full Code Here

    if (aclUsersGroups.contains(name)) {
      List<Value> values = super.getPropertyValues(source, name);
      ArrayList<Value> newValues = new ArrayList<Value>(values.size());
      for (Value value : values) {
        Principal principal = (value instanceof PrincipalValue)
            ? ((PrincipalValue) value).getPrincipal()
            : new Principal(value.toString().trim());

        if (caseSensitivityType != null &&
            principal.getCaseSensitivityType() != caseSensitivityType) {
          if (LOGGER.isLoggable(Level.FINEST)) {
            LOGGER.finest("Changing " + principal.getName()
                + " caseSensitivityType to " + caseSensitivityType);
          }

          Principal newPrincipal = new Principal(principal.getPrincipalType(),
              principal.getNamespace(), getPrincipalName(principal, name),
                  caseSensitivityType);

          newValues.add(new PrincipalValue(newPrincipal));
        } else {
          Principal newPrincipal = new Principal(principal.getPrincipalType(),
                  principal.getNamespace(), getPrincipalName(principal, name),
                  principal.getCaseSensitivityType());
          newValues.add(new PrincipalValue(newPrincipal));
        }
      }
View Full Code Here

    aclHelper.processPrincipal(principal, users, groups, principalName, siteUrl,
        memberships, webState);

    String expectedGroup = String.format("[%s]%s", siteUrl, principalName);
    Set<Principal> expectedGroups = ImmutableSet.of(
        new Principal(UNQUALIFIED, localNamespace, expectedGroup,
            EVERYTHING_CASE_INSENSITIVE));
    assertEquals(expectedGroups, groups);
    verify(dao, webState);
  }
View Full Code Here

      return namespace;
    }

    private Value asPrincipalValue(String name, String namespace)
        throws RepositoryDocumentException {
      return Value.getPrincipalValue(new Principal(PrincipalType.UNKNOWN,
          namespace, name, CaseSensitivityType.EVERYTHING_CASE_SENSITIVE));
    }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.spi.Principal

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.