Package com.google.appengine.api.users

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


        this.characterDao = characterDao;
    }

    @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 {
            loginDto.setLoggedIn(Boolean.FALSE);
            String loginUrl = userService.createLoginURL(requestUri);
            loginDto.setLoginUrl(createGwtLocaleAwareUrl(requestUri, loginUrl, locale));
        }
        if (isDevelopmentMode(requestUri)) {
            loginDto.setRussianUrl("?gwt.codesvr=127.0.0.1:9997&locale=ru");
            loginDto.setEnglishUrl("?gwt.codesvr=127.0.0.1:9997");
View Full Code Here


        return userDao.get(userKey);
    }

    @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

    return UserServiceFactory.getUserService().isUserAdmin();
  }
 
  public static DBUser userLogin()
  {
    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 dbuser;
  }
 
  public static String userLoginLogoutUrl(String dest)
  {
    UserService userServ = UserServiceFactory.getUserService();
   
    if(userServ.isUserLoggedIn())
      return userServ.createLogoutURL(dest);
    else
      return userServ.createLoginURL(dest);
  }
View Full Code Here

    String retorno = null;
    try {
      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("/");
      }
     
View Full Code Here

    // TODO Auto-generated method stub
    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

            req, resp);
      } 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
View Full Code Here

  private String afterLoginEndpoint;
  private String afterLogoutEndpoint;

  public boolean isUserLoggedIn() {
    UserService userService = UserServiceFactory.getUserService();

    return userService.isUserLoggedIn();
  }
View Full Code Here

    return userService.isUserLoggedIn();
  }

  public boolean isUserAdmin() {
    UserService userService = UserServiceFactory.getUserService();

    try {
      return userService.isUserAdmin();
    } catch (IllegalStateException ex) {
      return false;
    }
  }
View Full Code Here

      return createLogoutUrl("/");
    }
  }

  public User getUser() {
    UserService userService = UserServiceFactory.getUserService();
    com.google.appengine.api.users.User currentUser =
        userService.getCurrentUser();

    if (currentUser == null) {
      return null;
    }

    User user = new User();
    user.setId(currentUser.getUserId());
    user.setName(currentUser.getNickname());
    user.setEmail(currentUser.getEmail());
    user.setIsAdmin(userService.isUserAdmin());

    return user;
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.users.UserService

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.