Package net.sf.chellow.physical

Examples of net.sf.chellow.physical.User


    if (method.equals(HttpMethod.GET)
        && (pathInfo.equals("/") || pathInfo.startsWith("/style/"))) {
      return;
    }
    User user = inv.getUser();
    if (user == null) {
      user = ImplicitUserSource.getUser(inv);
    }
    if (user == null) {
      try {
        Long userCount = (Long) Hiber.session()
            .createQuery("select count(*) from User user")
            .uniqueResult();
        if (userCount == null
            || userCount == 0
            && InetAddress.getByName(
                inv.getRequest().getRemoteAddr())
                .isLoopbackAddress()) {
          return;
        }
      } catch (UnknownHostException e) {
        throw new InternalException(e);
      }
      throw new UnauthorizedException();
    }
    UserRole role = user.getRole();
    String roleCode = role.getCode();
    if (roleCode.equals(UserRole.VIEWER)) {
      if (pathInfo.startsWith("/reports/")
          && pathInfo.endsWith("/output/")
          && (method.equals(HttpMethod.GET) || method
              .equals(HttpMethod.HEAD))) {
        return;
      }
    } else if (roleCode.equals(UserRole.EDITOR)) {
      return;
    } else if (roleCode.equals(UserRole.PARTY_VIEWER)) {
      if (method.equals(HttpMethod.GET) || method.equals(HttpMethod.HEAD)) {
        Party party = user.getParty();
        char marketRoleCode = party.getRole().getCode();
        if (marketRoleCode == MarketRole.HHDC) {
          Long hhdcContractId = inv.getLong("hhdc-contract-id");
          if (!inv.isValid()) {
            throw new ForbiddenException(
View Full Code Here


import net.sf.chellow.physical.Configuration;
import net.sf.chellow.physical.User;

public class ImplicitUserSource {
  static public User getUser(Invocation inv) throws HttpException {
    User user = null;
    Configuration configuration = Configuration.getConfiguration();
    String emailAddressString = configuration.getProperty("ip*-*-*-*");

    if (emailAddressString == null) {
      emailAddressString = configuration.getProperty("ip"
View Full Code Here

  public MonadUri getEditUri() throws HttpException {
    return null;
  }

  public void httpGet(Invocation inv) throws HttpException {
    User user = inv.getUser();
    if (user == null) {
      user = ImplicitUserSource.getUser(inv);
    }
    inv.sendFound(user.getEditUri());
  }
View Full Code Here

      return null;
      // throw new BadRequestException(
      // "The Authorisation header must contain a base64 encoded string
      // consisting of a username and password separated by a ':'.");
    }
    User user = Chellow.USERS_INSTANCE.findUser(new EmailAddress(
        usernameAndPassword[0]));
    if (user == null) {
      return null;
    } else if (!user.getPasswordDigest().equals(
        User.digest(usernameAndPassword[1]))) {
      return null;
    }
    return user;
  }
View Full Code Here

TOP

Related Classes of net.sf.chellow.physical.User

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.