Package ch.entwine.weblounge.common.site

Examples of ch.entwine.weblounge.common.site.Site


  public int doStartTag() throws JspException {
    super.doStartTag();

    WebloungeRequest request = getRequest();
    User user = request.getUser();
    Site site = request.getSite();
    if (!hasOneOf(user, site) || !hasAllOf(user, site))
      return EVAL_BODY_INCLUDE;
    else
      return SKIP_BODY;
  }
View Full Code Here


   * @throws ContentRepositoryUnavailableException
   *           if the repository is offline
   */
  private boolean loadNextPage() throws ContentRepositoryException,
  ContentRepositoryUnavailableException {
    Site site = request.getSite();

    // Check if headers have already been loaded
    if (pages == null) {
      ContentRepository repository = site.getContentRepository();
      if (repository == null) {
        logger.debug("Unable to load content repository for site '{}'", site);
        throw new ContentRepositoryUnavailableException();
      }

View Full Code Here

  protected SiteManager sites = null;

  @GET
  @Path("/")
  public Response getStatistics(@Context HttpServletRequest request) {
    Site site = getSite(request);

    try {
      StringBuilder stats = new StringBuilder();
      stats.append("<directory id=\"").append(site.getIdentifier()).append("\">");
      stats.append("<enabled>").append(directory.isSiteEnabled(site)).append("</enabled>");
      stats.append("<users>").append(directory.getAccounts(site).size()).append("</users>");
      stats.append("</directory>");
      Response response = Response.ok(stats.toString()).build();
      return response;
View Full Code Here

  }

  @PUT
  @Path("/status")
  public Response enableSite(@Context HttpServletRequest request) {
    Site site = getSite(request);

    // Make sure that the user owns the roles required for this operation
    User user = securityService.getUser();
    if (!SecurityUtils.userHasRole(user, SystemRole.SITEADMIN))
      return Response.status(Status.FORBIDDEN).build();
View Full Code Here

  }

  @DELETE
  @Path("/status")
  public Response disableSite(@Context HttpServletRequest request) {
    Site site = getSite(request);

    // Make sure that the user owns the roles required for this operation
    User user = securityService.getUser();
    if (!SecurityUtils.userHasRole(user, SystemRole.SITEADMIN))
      return Response.status(Status.FORBIDDEN).build();
View Full Code Here

    // Check the arguments
    if (StringUtils.isBlank(login))
      return Response.status(Status.BAD_REQUEST).build();

    Response response = null;
    Site site = getSite(request);

    // Hash the password
    if (StringUtils.isNotBlank(password)) {
      logger.debug("Hashing password for user '{}@{}' using md5", login, site.getIdentifier());
      password = PasswordEncoder.encode(StringUtils.trim(password));
    }

    // Create the user
    try {
View Full Code Here

  @GET
  @Path("/account/{login}")
  public Response getAccount(@PathParam("login") String login,
      @Context HttpServletRequest request) {
    Site site = getSite(request);

    JpaAccount account = null;
    try {
      account = directory.getAccount(site, login);
    } catch (Throwable t) {
View Full Code Here

  @GET
  @Path("/account/{login}/activate")
  public Response activateAccount(@PathParam("login") String login,
      @QueryParam("activation") String activation,
      @Context HttpServletRequest request) {
    Site site = getSite(request);
    try {
      boolean success = directory.activateAccount(site, login, activation);
      return (success) ? Response.ok().build() : Response.status(Status.UNAUTHORIZED).build();
    } catch (Throwable t) {
      logger.warn("Error activating account '{}': {}", login, t.getMessage());
View Full Code Here

    User user = securityService.getUser();
    if (!SecurityUtils.userHasRole(user, SystemRole.SITEADMIN) && !user.getLogin().equals(login))
      return Response.status(Status.FORBIDDEN).build();

    JpaAccount account = null;
    Site site = getSite(request);
    try {
      account = directory.getAccount(site, login);
      if (account == null)
        return Response.status(Status.NOT_FOUND).build();

      // Hash the password
      if (StringUtils.isNotBlank(password)) {
        logger.debug("Hashing password for user '{}@{}' using md5", login, site.getIdentifier());
        String digestPassword = PasswordEncoder.encode(StringUtils.trim(password));
        account.setPassword(digestPassword);
      }

      account.setFirstname(StringUtils.trimToNull(firstname));
      account.setLastname(StringUtils.trimToNull(lastname));
      account.setInitials(StringUtils.trimToNull(initials));
      account.setEmail(StringUtils.trimToNull(email));

      // The language
      if (StringUtils.isNotBlank(language)) {
        try {
          account.setLanguage(LanguageUtils.getLanguage(language));
        } catch (UnknownLanguageException e) {
          return Response.status(Status.BAD_REQUEST).build();
        }
      } else {
        account.setLanguage(null);
      }

      // Hash the response
      if (StringUtils.isNotBlank(response)) {
        logger.debug("Hashing response for user '{}@{}' using md5", login, site.getIdentifier());
        String digestResponse = PasswordEncoder.encode(StringUtils.trim(response));
        account.setResponse(digestResponse);
      }

      directory.updateAccount(account);
View Full Code Here

    User user = securityService.getUser();
    if (!SecurityUtils.userHasRole(user, SystemRole.SITEADMIN) && !user.getLogin().equals(login))
      return Response.status(Status.FORBIDDEN).build();

    JpaAccount account = null;
    Site site = getSite(request);
    try {
      account = directory.getAccount(site, login);
      if (account == null)
        return Response.status(Status.NOT_FOUND).build();

      // Hash the password
      if (StringUtils.isNotBlank(password)) {
        logger.debug("Hashing password for user '{}@{}' using md5", login, site.getIdentifier());
        String digestPassword = PasswordEncoder.encode(StringUtils.trim(password));
        account.setPassword(digestPassword);
      } else {
        account.setPassword(null);
      }
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.site.Site

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.