Package ch.entwine.weblounge.common.impl.security

Examples of ch.entwine.weblounge.common.impl.security.UserImpl


   * {@link ch.entwine.weblounge.common.impl.content.CreationContext#setCreator(ch.entwine.weblounge.common.security.User)}
   * .
   */
  @Test
  public void testSetCreator() {
    User u = new UserImpl("james", "testland");
    ctx.setCreator(u);
    assertTrue(u.equals(ctx.getCreator()));
  }
View Full Code Here


   * .
   */
  @Test
  public void testGetWithAuthor() throws Exception {
    populateIndex();
    User amelie = new UserImpl("amelie");
    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withAuthor(amelie);
    SearchResult result = idx.getByQuery(q);
    assertEquals(pages.length, result.getDocumentCount());
    assertEquals(pages.length, result.getDocumentCount());
  }
View Full Code Here

   * .
   */
  @Test
  public void testGetWithCreator() throws Exception {
    populateIndex();
    User hans = new UserImpl("hans");
    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withCreator(hans);
    SearchResult result = idx.getByQuery(q);
    assertEquals(pages.length, result.getDocumentCount());
    assertEquals(pages.length, result.getDocumentCount());
  }
View Full Code Here

   * .
   */
  @Test
  public void testGetWithModifier() throws Exception {
    populateIndex();
    User amelie = new UserImpl("amelie");
    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withModifier(amelie);
    SearchResult result = idx.getByQuery(q);
    assertEquals(pages.length, result.getDocumentCount());
    assertEquals(pages.length, result.getDocumentCount());
  }
View Full Code Here

   * .
   */
  @Test
  public void testGetWithPublisher() throws Exception {
    populateIndex();
    User amelie = new UserImpl("amelie");
    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withPublisher(amelie);
    SearchResult result = idx.getByQuery(q);
    assertEquals(1, result.getDocumentCount());
    assertEquals(1, result.getDocumentCount());
  }
View Full Code Here

      else if (filter.startsWith("locked:") && filter.length() > "locked:".length()) {
        String lockOwner = StringUtils.trim(filter.substring("locked:".length()));
        if ("me".equals(lockOwner))
          q.withLockOwner(securityService.getUser());
        else
          q.withLockOwner(new UserImpl(lockOwner));
      } else if (filter.startsWith("creator:") && filter.length() > "creator:".length()) {
        String creator = StringUtils.trim(filter.substring("creator:".length()));
        if ("me".equals(creator))
          q.withCreator(securityService.getUser());
        else
          q.withCreator(new UserImpl(creator));
      } else if (filter.startsWith("modifier:") && filter.length() > "modifier:".length()) {
        String modifier = StringUtils.trim(filter.substring("modifier:".length()));
        if ("me".equals(modifier))
          q.withModifier(securityService.getUser());
        else
          q.withModifier(new UserImpl(modifier));
      } else if (filter.startsWith("publisher:") && filter.length() > "publisher:".length()) {
        String publisher = StringUtils.trim(filter.substring("publisher:".length()));
        if ("me".equals(publisher))
          q.withPublisher(securityService.getUser());
        else
          q.withPublisher(new UserImpl(publisher));
      }

      // by date

      else if (filter.startsWith("created:") && filter.length() > "created:".length()) {
View Full Code Here

    // Make sure there is a home page
    ResourceURI homeURI = new ResourceURIImpl(Page.TYPE, site, "/");
    if (!existsInAnyVersion(homeURI)) {
      try {
        Page page = new PageImpl(homeURI);
        User siteAdmininstrator = new UserImpl(site.getAdministrator());
        page.setTemplate(site.getDefaultTemplate().getIdentifier());
        page.setCreated(siteAdmininstrator, new Date());
        page.setPublished(siteAdmininstrator, new Date(), null);
        put(page, true);
        logger.info("Created homepage for {}", site.getIdentifier());
View Full Code Here

      else if (filter.startsWith("creator:") && filter.length() > "creator:".length()) {
        String creator = StringUtils.trim(filter.substring("creator:".length()));
        if ("me".equals(creator))
          q.withCreator(securityService.getUser());
        else
          q.withCreator(new UserImpl(creator));
      } else if (filter.startsWith("modifier:") && filter.length() > "modifier:".length()) {
        String modifier = StringUtils.trim(filter.substring("modifier:".length()));
        if ("me".equals(modifier))
          q.withModifier(securityService.getUser());
        else
          q.withModifier(new UserImpl(modifier));
      } else if (filter.startsWith("publisher:") && filter.length() > "publisher:".length()) {
        String publisher = StringUtils.trim(filter.substring("publisher:".length()));
        if ("me".equals(publisher))
          q.withPublisher(securityService.getUser());
        else
          q.withPublisher(new UserImpl(publisher));
      }

      // by date

      else if (filter.startsWith("created:") && filter.length() > "created:".length()) {
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.impl.security.UserImpl

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.