|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.onebusaway.users.impl.UserServiceImpl
@Component public class UserServiceImpl
Constructor Summary | |
---|---|
UserServiceImpl()
|
Method Summary | |
---|---|
UserIndex |
addUserIndexToUser(User user,
UserIndexKey key,
String credentials)
Add a UserIndex with the specified id and credentials to an
existing user, returning the new index. |
void |
clearPhoneNumberRegistration(UserIndexKey userIndexKey)
Reset a previous call to UserService.registerPhoneNumber(User, String) for the
specified user |
UserIndex |
completePhoneNumberRegistration(UserIndex userIndex,
String registrationCode)
Complete phone number registration. |
void |
deleteStaleUsers()
Deletes stale users from the system. |
void |
deleteUser(User user)
Delete the specified user. |
void |
disableAdminRoleForUser(User user,
boolean onlyIfOtherAdmins)
Remove the admin role for a User. |
void |
enableAdminRoleForUser(User user,
boolean onlyIfNoOtherAdmins)
Enable the admin role for a User. |
List<Integer> |
getAllUserIds()
|
List<Integer> |
getAllUserIdsInRange(int offset,
int limit)
|
UserBean |
getAnonymousUser()
|
Long |
getMinApiRequestIntervalForKey(String key,
boolean forceRefresh)
|
int |
getNumberOfAdmins()
|
int |
getNumberOfUsers()
UserService Interface |
UserIndex |
getOrCreateUserForIndexKey(UserIndexKey key,
String credentials,
boolean isAnonymous)
|
UserIndex |
getOrCreateUserForUsernameAndPassword(String username,
String password)
|
UserBean |
getUserAsBean(User user)
|
User |
getUserForId(int userId)
|
UserIndex |
getUserIndexForId(UserIndexKey key)
|
List<String> |
getUserIndexKeyValuesForKeyType(String keyType)
|
UserPropertiesMigrationStatus |
getUserPropertiesMigrationStatus()
See UserPropertiesMigration |
boolean |
hasPhoneNumberRegistration(UserIndexKey userIndexKey)
|
boolean |
isAdministrator(User user)
Is the specified user an administrator? See the discussion in StandardAuthoritiesService |
boolean |
isAnonymous(User user)
Is the specified user anonymous? See the discussion in StandardAuthoritiesService |
void |
mergeUsers(User sourceUser,
User targetUser)
Given two user accounts, merge the two users into one. |
String |
registerPhoneNumber(User user,
String phoneNumber)
Begin phone number registration for the specified user. |
void |
removeUserIndexForUser(User user,
UserIndexKey key)
Remove the UserIndex with the specified id from the user. |
void |
resetUser(User user)
Reset all properties for the specified user to default values. |
void |
setAuthoritiesService(StandardAuthoritiesService authoritiesService)
|
void |
setCredentialsForUserIndex(UserIndex userIndex,
String credentials)
Update the credentials for the specified user index |
void |
setPasswordEncoder(org.springframework.security.providers.encoding.PasswordEncoder passwordEncoder)
|
void |
setPasswordForUsernameUserIndex(UserIndex userIndex,
String password)
Update the password for the UserIndexTypes.USERNAME user index |
void |
setUserDao(UserDao dao)
|
void |
setUserIndexRegistrationService(UserIndexRegistrationService userIndexRegistrationService)
|
void |
setUserPropertiesService(UserPropertiesService userPropertiesService)
|
void |
start()
|
void |
startUserPropertiesMigration()
Start the user property migration task - see UserPropertiesMigration |
void |
stop()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UserServiceImpl()
Method Detail |
---|
public void setUserDao(UserDao dao)
public void setAuthoritiesService(StandardAuthoritiesService authoritiesService)
public void setUserPropertiesService(UserPropertiesService userPropertiesService)
public void setUserIndexRegistrationService(UserIndexRegistrationService userIndexRegistrationService)
public void setPasswordEncoder(org.springframework.security.providers.encoding.PasswordEncoder passwordEncoder)
@PostConstruct public void start()
@PreDestroy public void stop()
public int getNumberOfUsers()
UserService
Interface
getNumberOfUsers
in interface UserService
public List<Integer> getAllUserIds()
getAllUserIds
in interface UserService
public List<Integer> getAllUserIdsInRange(int offset, int limit)
getAllUserIdsInRange
in interface UserService
offset
- index offset into the full user id listlimit
- length of subset of the user id list to return
public int getNumberOfAdmins()
getNumberOfAdmins
in interface UserService
public User getUserForId(int userId)
getUserForId
in interface UserService
userId
- see User.getId()
public UserBean getUserAsBean(User user)
getUserAsBean
in interface UserService
public UserBean getAnonymousUser()
getAnonymousUser
in interface UserService
public void resetUser(User user)
UserService
resetUser
in interface UserService
public void deleteUser(User user)
UserService
UserIndex
objects
pointing to that user as well.
deleteUser
in interface UserService
public boolean isAnonymous(User user)
UserService
StandardAuthoritiesService
isAnonymous
in interface UserService
public boolean isAdministrator(User user)
UserService
StandardAuthoritiesService
isAdministrator
in interface UserService
public void enableAdminRoleForUser(User user, boolean onlyIfNoOtherAdmins)
UserService
enableAdminRoleForUser
in interface UserService
user
- the user to mark as an adminonlyIfNoOtherAdmins
- when true, will only add the admin role if no
other users are marked as adminpublic void disableAdminRoleForUser(User user, boolean onlyIfOtherAdmins)
UserService
disableAdminRoleForUser
in interface UserService
onlyIfOtherAdmins
- when true, will only remove the admin role if at
least one other user is marked as adminpublic List<String> getUserIndexKeyValuesForKeyType(String keyType)
getUserIndexKeyValuesForKeyType
in interface UserService
public UserIndex getOrCreateUserForIndexKey(UserIndexKey key, String credentials, boolean isAnonymous)
getOrCreateUserForIndexKey
in interface UserService
key
- see UserIndex.getId()
credentials
- UserIndex.getCredentials()
isAnonymous
- is a newly created user anonymous -
User.getRoles()
public UserIndex getOrCreateUserForUsernameAndPassword(String username, String password)
getOrCreateUserForUsernameAndPassword
in interface UserService
public UserIndex getUserIndexForId(UserIndexKey key)
getUserIndexForId
in interface UserService
key
- see UserIndex.getId()
public UserIndex addUserIndexToUser(User user, UserIndexKey key, String credentials)
UserService
UserIndex
with the specified id and credentials to an
existing user, returning the new index. If an index with the specified id
already exists, it is returned instead.
addUserIndexToUser
in interface UserService
user
- the target userkey
- see UserIndex.getId()
credentials
- see UserIndex.getCredentials()
public void removeUserIndexForUser(User user, UserIndexKey key)
UserService
UserIndex
with the specified id from the user.
removeUserIndexForUser
in interface UserService
key
- see UserIndex.getId()
public void setCredentialsForUserIndex(UserIndex userIndex, String credentials)
UserService
setCredentialsForUserIndex
in interface UserService
public void setPasswordForUsernameUserIndex(UserIndex userIndex, String password)
UserService
UserIndexTypes.USERNAME
user index
setPasswordForUsernameUserIndex
in interface UserService
public void mergeUsers(User sourceUser, User targetUser)
UserService
mergeUsers
in interface UserService
sourceUser
- this user will be deletedtargetUser
- this user will be updated and keptpublic String registerPhoneNumber(User user, String phoneNumber)
UserService
UserService.completePhoneNumberRegistration(UserIndex, String)
to verify that
they do in fact own that phone number.
registerPhoneNumber
in interface UserService
UserService.completePhoneNumberRegistration(UserIndex, String)
public boolean hasPhoneNumberRegistration(UserIndexKey userIndexKey)
hasPhoneNumberRegistration
in interface UserService
public UserIndex completePhoneNumberRegistration(UserIndex userIndex, String registrationCode)
UserService
UserService.registerPhoneNumber(User, String)
,
then registration is completed by creating a new UserIndex
with
type UserIndexTypes.PHONE_NUMBER
with the phone number specified in
the previous call to register phone number.
completePhoneNumberRegistration
in interface UserService
UserIndex
object for the phone number
user indexpublic void clearPhoneNumberRegistration(UserIndexKey userIndexKey)
UserService
UserService.registerPhoneNumber(User, String)
for the
specified user
clearPhoneNumberRegistration
in interface UserService
public void startUserPropertiesMigration()
UserService
UserPropertiesMigration
startUserPropertiesMigration
in interface UserService
public UserPropertiesMigrationStatus getUserPropertiesMigrationStatus()
UserService
UserPropertiesMigration
getUserPropertiesMigrationStatus
in interface UserService
public void deleteStaleUsers()
UserService
deleteStaleUsers
in interface UserService
@Transactional public Long getMinApiRequestIntervalForKey(String key, boolean forceRefresh)
getMinApiRequestIntervalForKey
in interface UserService
key
- an API keyforceRefresh
- guarantees that supplied value has not been cached
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |