use of org.onebusaway.users.model.UserIndex in project onebusaway-application-modules by camsys.
the class UserDetailsServiceImpl method getOrCreateUserForIndexKey.
@Override
public IndexedUserDetails getOrCreateUserForIndexKey(UserIndexKey key, String credentials, boolean isAnonymous) throws DataAccessException {
UserIndex userIndex = _userService.getOrCreateUserForIndexKey(key, credentials, isAnonymous);
setLastAccessTimeForUser(userIndex);
return new IndexedUserDetailsImpl(_authoritiesService, userIndex);
}
use of org.onebusaway.users.model.UserIndex in project onebusaway-application-modules by camsys.
the class CreateUserAction method execute.
@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);
}
}
use of org.onebusaway.users.model.UserIndex in project onebusaway-application-modules by camsys.
the class CurrentUserServiceImpl method handleAddAccount.
@Override
public IndexedUserDetails handleAddAccount(String type, String id, 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);
else
index = _userService.getOrCreateUserForIndexKey(key, credentials, isAnonymous);
}
return new IndexedUserDetailsImpl(_authoritiesService, index);
}
use of org.onebusaway.users.model.UserIndex in project onebusaway-application-modules by camsys.
the class CurrentUserServiceImpl method completePhoneNumberRegistration.
@Override
public boolean completePhoneNumberRegistration(String registrationCode) {
UserIndex userIndex = _currentUserStrategy.getCurrentUserIndex(false);
if (userIndex == null)
return false;
userIndex = _userService.completePhoneNumberRegistration(userIndex, registrationCode);
if (userIndex == null)
return false;
_currentUserStrategy.setCurrentUser(userIndex);
return true;
}
use of org.onebusaway.users.model.UserIndex in project onebusaway-application-modules by camsys.
the class CurrentUserServiceImpl method handleRegistration.
@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);
}
Aggregations