Package ch.entwine.weblounge.common.site

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


    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();

      // Set the challenge
      account.setChallenge(StringUtils.trimToNull(challenge));

      // 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);
      } else {
        account.setResponse(response);
      }
View Full Code Here


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

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

    User user = securityService.getUser();
    if (!SecurityUtils.userHasRole(user, SystemRole.SITEADMIN))
      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();
      if (account.isEnabled())
View Full Code Here

  public static String processTemplate(String text, Module module,
      Environment environment) {
    text = processTemplate(text);

    Map<String, String> replacements = new HashMap<String, String>();
    Site site = module.getSite();

    // ${site.root}
    StringBuffer siteRootReplacement = new StringBuffer();
    siteRootReplacement.append(site.getHostname(environment).toExternalForm());
    siteRootReplacement.append("/weblounge-sites/").append(site.getIdentifier());
    replacements.put("file://\\$\\{site.root\\}", siteRootReplacement.toString());

    // ${module.root}
    StringBuffer moduleRootReplacement = new StringBuffer(siteRootReplacement);
    moduleRootReplacement.append("/modules/").append(module.getIdentifier());
    replacements.put("file://\\$\\{module.root\\}", moduleRootReplacement.toString());
   
    // Site options
    for (String option : site.getOptionNames()) {
      String value = site.getOptionValue(option);
      replacements.put("\\$\\{" + option + "\\}", value);
    }

    // Replace with whatever is available
    for (Map.Entry<String, String> entry : replacements.entrySet()) {
View Full Code Here

    User user = securityService.getUser();
    if (!SecurityUtils.userHasRole(user, SystemRole.SITEADMIN))
      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();
      if (!account.isEnabled())
View Full Code Here

    // Make sure a role has been provided as part of the request
    if (StringUtils.isBlank(role))
      return Response.status(Status.BAD_REQUEST).build();

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

    // Make sure a role has been provided as part of the request
    if (StringUtils.isBlank(role))
      return Response.status(Status.BAD_REQUEST).build();

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

   *           if the site is not found or is not running
   */
  protected Site getSite(HttpServletRequest request)
      throws WebApplicationException {
    URL url = UrlUtils.toURL(request, false, false);
    Site site = sites.findSiteByURL(url);
    if (site == null) {
      throw new WebApplicationException(Status.NOT_FOUND);
    } else if (!site.isOnline()) {
      throw new WebApplicationException(Status.SERVICE_UNAVAILABLE);
    }
    return site;
  }
View Full Code Here

   * {@inheritDoc}
   *
   * @see javax.servlet.jsp.tagext.BodyTagSupport#doStartTag()
   */
  public int doStartTag() throws JspException {
    Site site = request.getSite();
    Language language = request.getLanguage();

    ContentRepository repository = site.getContentRepository();
    if (repository == null) {
      logger.debug("Unable to load content repository for site '{}'", site);
      response.invalidate();
      return SKIP_BODY;
    }
View Full Code Here

    // Don't do work if not needed (which is the case during precompilation)
    if (RequestUtils.isPrecompileRequest(request))
      return SKIP_BODY;

    Site site = request.getSite();

    ContentRepository repository = site.getContentRepository();
    if (repository == null) {
      logger.debug("Unable to load content repository for site '{}'", site);
      response.invalidate();
      throw new JspException();
    }
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.