Package com.google.appengine.api.users

Examples of com.google.appengine.api.users.User


      ServletContext context = ServletActionContext.getServletContext();
      HttpServletRequest request = ServletActionContext.getRequest();
      HttpServletResponse response = ServletActionContext.getResponse();
      UserService userService = UserServiceFactory.getUserService();
      Map<String, Object> session = ActionContext.getContext().getSession();
      User user = userService.getCurrentUser();
     
      if(user==null){
        response.sendRedirect("/");
      }
     
      String mailusu=user.getEmail().toLowerCase();
      log.info("mail del usuario google: " + mailusu);

      usuarioList = UsuarioLNBO
          .obtenerUsuarioPorEmailLVS(user.getEmail());
     
      if(usuarioList==null) throw new Exception("La lista de usuarios esta vacia");

      if (!usuarioList.isEmpty() ) {
       
        usuarioLN = usuarioList.get(0);

        if (user.getEmail().equals(usuarioLN.getEmail())) {

          request.setAttribute("uid", String.valueOf(usuarioLN
              .getId()));
          request.setAttribute("perfil", String.valueOf(usuarioLN
              .getPerfil()));
          Long usrId=usuarioLN.getId();
          session.put("logueado", "true");
          session.put("IdNegocio", usuarioLN.getIdNegocio());
          session.put("perfil", usuarioLN.getPerfil());
          session.put("IdUsuario",usrId);

          UsuarioLN usuario=UsuarioLNBO.editarUsuarioLN(String.valueOf(usrId));
          NegocioLN negocio=NegocioLNBO.editarNegocioLN(String.valueOf(usuario.getIdNegocio()));

          String txtNegocio=negocio.getNombre();
          if(txtNegocio!=null){
            session.put("txtNegocio", txtNegocio);
          }else{
            session.put("txtNegocio", "sin negocio");
          }

         
          log.info("usuarioLN.getPerfil(): " + usuarioLN.getPerfil());
          retorno = ActionSupport.SUCCESS;
        } else {
          log.info("no coinciden los usuarios!!");
          throw new Exception("no coinciden los usuarios!!");
        }
      } else {

        log.info("no existe el usuario " + mailusu + " en la base de datos!!");

        String usuario_nombres = context
            .getInitParameter("usuario_nombres");
        String usuario_apepa = context
            .getInitParameter("usuario_apepa");
        String usuario_apema = context
            .getInitParameter("usuario_apema");
        String usuario_mail = context
            .getInitParameter("usuario_mail");
        String usuario_cargo = context
            .getInitParameter("usuario_cargo");
        String usuario_perfil = context
        .getInitParameter("usuario_perfil");

        log.info("usuario_mail:" + usuario_mail);
        log.info("mailusu:" + mailusu);

        if (mailusu.equals(usuario_mail)) {

          UsuarioLNBO.guardarUsuarioLN(usuario_nombres,
              usuario_apepa, usuario_apema, usuario_mail,
              usuario_perfil.charAt(0), usuario_cargo, "0", "0");
         
          UsuarioLN usr=((UsuarioLN)UsuarioLNBO.obtenerUsuarioPorEmailLVS(user
              .getEmail()).get(0));

          request.setAttribute("uid", usr.getId());
          request.setAttribute("perfil", Character
              .valueOf(usr.getPerfil()));
View Full Code Here


    }

    @Override
    public LoginDto login(String requestUri, String locale) {
        UserService userService = googleAppEngineServices.getUserService();
        User googleUser = userService.getCurrentUser();

        LoginDto loginDto = new LoginDto();
        if (googleUser != null) {
            lv.odylab.evemanage.domain.user.User user = ensureUserExists(googleUser);
            loginDto.setLoggedIn(Boolean.TRUE);
            loginDto.setUserID(user.getId());
            loginDto.setEmailAddress(googleUser.getEmail());
            loginDto.setNickname(googleUser.getNickname());
            String logoutUrl = userService.createLogoutURL(requestUri);
            loginDto.setLogoutUrl(createGwtLocaleAwareUrl(requestUri, logoutUrl, locale));
            loginDto.setAdmin(userService.isUserAdmin());
            loginDto.setRoles(user.getRoles());
        } else {
View Full Code Here

    }

    @Override
    public Key<lv.odylab.evemanage.domain.user.User> getCurrentUserKey() {
        UserService userService = googleAppEngineServices.getUserService();
        User googleUser = userService.getCurrentUser();
        if (googleUser != null) {
            return userDao.geKeyByUserAuthID(googleUser.getUserId());
        }
        return null;
    }
View Full Code Here

  {
    UserService userServ = UserServiceFactory.getUserService();
    if(!userServ.isUserLoggedIn())
      return null;
   
    User user =userServ.getCurrentUser();
   
    DBUser dbuser = DBUser.createOrUpdateUser(user);
   
    return dbuser;
  }
View Full Code Here

    return null;
  }
 
  private User getRequiredCurrentUser() {
      UserService userService = UserServiceFactory.getUserService();
      User user = userService.getCurrentUser();
        if (user == null)
          throw new IllegalArgumentException("no user logged in");
        return user;
  }
View Full Code Here

    try {
      String siteTitle = req.getParameter("siteTitle");
      String siteDescription = req.getParameter("siteDescription");
      String siteKeyword = req.getParameter("siteKeyword");
      if (!NamespaceManager.get().equals(Setting.getGeneralNamespace())) {
        User user = UserServiceFactory.getUserService()
            .getCurrentUser();
        Application app = ApplicationModel.getById(NamespaceManager
            .get());
        if (app != null && user != null
            && user.getEmail().equals(app.getUserEmail())) {
          NamespaceManager.set(app.getId());
          ApplicationConfig config = ApplicationConfigModel.getById(
              NamespaceManager.get(), NamespaceManager.get());         
          config.setTitle(siteTitle);
          config.setDescription(siteDescription);
View Full Code Here

      } else {
        /*
         * Add site to default Namespace
         */
        UserService userService = UserServiceFactory.getUserService();
        User user = userService.getCurrentUser();
        obj.setUserEmail(user.getEmail());
        ApplicationModel.insert(obj);

        /*
         * Add relate site object to detail Namespace (incluse site
         * config and site template)
View Full Code Here

    String endHtml = "</h2></body></html>";
    String novaLínia = "<br></br>";
    String llibre, entrada, valor;
   
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    if (user !=null) {
      Date date = new Date();
      llibre = req.getParameter("llibre");
      entrada = req.getParameter("entrada");
      valor = req.getParameter("valor");
View Full Code Here

    setCredentialsMatcher(new AllowAllCredentialsMatcher());
  }

  protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) {
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    if (user == null){
      throw new AccountException("Not authenticated.");
    }
   
    return new SimpleAuthenticationInfo(user, null, getName());
View Full Code Here

  @Override
  protected AuthenticationToken createToken(
      ServletRequest request, ServletResponse response) {
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    return createToken(user.getUserId(), null, request, response);
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.users.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.