Package org.onebusaway.users.model

Examples of org.onebusaway.users.model.UserIndex


        if (arg instanceof User) {
          User user = (User) arg;
          int version = getPropertiesVersion(user);
          maxVersion = Math.max(maxVersion, version);
        } else if (arg instanceof UserIndex) {
          UserIndex userIndex = (UserIndex) arg;
          int version = getPropertiesVersion(userIndex.getUser());
          maxVersion = Math.max(maxVersion, version);
        }
      }
    }
View Full Code Here


  @Override
  public Map<String, Object> isLoggingEnabledForUser(
      @CacheableArgument(keyProperty = "userIndexKey") IndexedUserDetails details) {
   
    UserIndexKey key = details.getUserIndexKey();
    UserIndex userIndex = _userService.getUserIndexForId(key);
    if (userIndex == null)
      return null;
    User user = userIndex.getUser();
    for (UserIndex index : user.getUserIndices()) {
      UserIndexKey id = index.getId();
      if (id.getType().equals("tccStudyId")) {
        Map<String, Object> entry = new HashMap<String, Object>();
        entry.put("tccStudyId", id.getValue());
View Full Code Here

    return getCurrentUser(false);
  }

  @Override
  public UserBean getCurrentUser(boolean createUserIfAppropriate) {
    UserIndex userIndex = _currentUserStrategy.getCurrentUserIndex(createUserIfAppropriate);
    if (userIndex == null)
      return null;
    return _userService.getUserAsBean(userIndex.getUser());
  }
View Full Code Here

  @Override
  public IndexedUserDetails handleLogin(String type, String id,
      String credentials, boolean isAnonymous, boolean registerIfNewUser) {

    UserIndexKey key = new UserIndexKey(type, id);
    UserIndex index = _userService.getUserIndexForId(key);
    boolean exists = index != null;

    // New user?
    if (!exists) {

      if (!registerIfNewUser)
        return null;

      index = _userService.getOrCreateUserForIndexKey(key, credentials, false);
      User newUser = index.getUser();

      User oldUser = _currentUserStrategy.getCurrentUser(false);
      if (oldUser != null && _userService.isAnonymous(oldUser))
        _userService.mergeUsers(oldUser, newUser);
    }
View Full Code Here

  @Override
  public IndexedUserDetails handleRegistration(String type, String id,
      String credentials, boolean isAnonymous) {

    UserIndexKey key = new UserIndexKey(type, id);
    UserIndex index = _userService.getOrCreateUserForIndexKey(key, credentials,
        isAnonymous);

    User oldUser = _currentUserStrategy.getCurrentUser(false);
    if (oldUser != null && _userService.isAnonymous(oldUser))
      _userService.mergeUsers(oldUser, index.getUser());

    return new IndexedUserDetailsImpl(_authoritiesService, index);
  }
View Full Code Here

      String credentials, boolean isAnonymous) {

    User currentUser = _currentUserStrategy.getCurrentUser(false);

    UserIndexKey key = new UserIndexKey(type, id);
    UserIndex index = _userService.getUserIndexForId(key);
    boolean exists = index != null;

    // New user?
    if (exists) {
      if (currentUser != null) {
        User existingUser = index.getUser();
        _userService.mergeUsers(existingUser, currentUser);
      }
    } else {
      if (currentUser != null)
        index = _userService.addUserIndexToUser(currentUser, key, credentials);
View Full Code Here

  }

  @Override
  public boolean completePhoneNumberRegistration(String registrationCode) {

    UserIndex userIndex = _currentUserStrategy.getCurrentUserIndex(false);
    if (userIndex == null)
      return false;

    userIndex = _userService.completePhoneNumberRegistration(userIndex,
        registrationCode);
View Full Code Here

    _currentUserStrategy.clearCurrentUser();
  }

  @Override
  public void removeUserIndex(UserIndexKey key) {
    UserIndex index = _currentUserStrategy.getCurrentUserIndex(false);
    if (index == null)
      return;
    boolean removingCurrentUserIndex = index.getId().equals(key);
    _userService.removeUserIndexForUser(index.getUser(), key);
    if (removingCurrentUserIndex)
      _currentUserStrategy.clearCurrentUser();
  }
View Full Code Here

  }

  @PostConstruct
  public void execute() {
    UserIndexKey userIndexKey = new UserIndexKey(UserIndexTypes.API_KEY, key);
    UserIndex userIndex = _userService.getOrCreateUserForIndexKey(userIndexKey,
        key, false);
    _userPropertiesService.authorizeApi(userIndex.getUser(), 0);
  }
View Full Code Here

  }

  @PostConstruct
  public void execute() {

    UserIndex userIndex = _userService.getOrCreateUserForUsernameAndPassword(
        username, password);

    if (userIndex == null)
      throw new IllegalStateException("error creating user");

    if (admin) {
      User user = userIndex.getUser();
      _userService.enableAdminRoleForUser(user, false);
    }
  }
View Full Code Here

TOP

Related Classes of org.onebusaway.users.model.UserIndex

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.