Package de.dlr.proseo.usermgr.rest
Klasse UserManager
java.lang.Object
de.dlr.proseo.usermgr.rest.UserManager
Service methods required to manage user accounts.
- Autor:
- Dr. Thomas Bassler
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic class
Exception to indicate unmodified data to caller -
Feldübersicht
Felder -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungcountUsers
(String mission) Count the users matching the specified mission, if anycreateUser
(RestUser restUser) Create a user (optionally with direct authorities)void
deleteUserByName
(String username) Delete a user by user namegetUserByName
(String username) Get a user by nameGet users by missionmodifyUser
(String username, RestUser restUser) Update a user by user name If the password is changed, the password expiration date will be updated according to the password expiration period configured.(Package privat) static User
toModelUser
(RestUser restUser) Convert a user from REST format to the prosEO data model format (including directly assigned authorities)(Package privat) static RestUser
toRestUser
(User modelUser) Convert a user from prosEO data model format to REST format (including directly assigned authorities)
-
Felddetails
-
userRepository
Repository for User objects
-
-
Konstruktordetails
-
UserManager
public UserManager()
-
-
Methodendetails
-
toModelUser
Convert a user from REST format to the prosEO data model format (including directly assigned authorities)- Parameter:
restUser
- the REST user to convert- Gibt zurück:
- the converted model user
- Löst aus:
IllegalArgumentException
- if an invalid authority value was given
-
toRestUser
Convert a user from prosEO data model format to REST format (including directly assigned authorities)- Parameter:
modelUser
- the model user to convert- Gibt zurück:
- the converted REST user
-
createUser
Create a user (optionally with direct authorities)- Parameter:
restUser
- a Json representation of the new user- Gibt zurück:
- a Json representation of the user after creation (with ACL security identity ID)
- Löst aus:
IllegalArgumentException
- if any of the input data was invalid
-
getUsers
public List<RestUser> getUsers(String mission, Integer recordFrom, Integer recordTo) throws javax.persistence.NoResultException, org.springframework.web.client.HttpClientErrorException Get users by mission- Parameter:
mission
- the mission coderecordFrom
- first record of filtered and ordered result to returnrecordTo
- last record of filtered and ordered result to return- Gibt zurück:
- a list of Json objects representing the users authorized for the given mission
- Löst aus:
javax.persistence.NoResultException
- if no user is found for the given missionorg.springframework.web.client.HttpClientErrorException
- if the result list exceeds a configured maximum
-
getUserByName
public RestUser getUserByName(String username) throws IllegalArgumentException, javax.persistence.NoResultException Get a user by name- Parameter:
username
- the user name- Gibt zurück:
- a Json object corresponding to the user found
- Löst aus:
IllegalArgumentException
- if no user name was givenjavax.persistence.NoResultException
- if no user with the given name exists
-
deleteUserByName
public void deleteUserByName(String username) throws javax.persistence.EntityNotFoundException, RuntimeException Delete a user by user name- Parameter:
username
- the name of the user to delete- Löst aus:
javax.persistence.EntityNotFoundException
- if the user to delete does not exist in the databaseRuntimeException
- if the deletion was not performed as expected
-
modifyUser
public RestUser modifyUser(String username, RestUser restUser) throws javax.persistence.EntityNotFoundException, IllegalArgumentException, UserManager.NotModifiedException Update a user by user name If the password is changed, the password expiration date will be updated according to the password expiration period configured. Note: This method cannot detect, whether a password was actually changed, because due to the BCrypt algorithm used the same password may yield different salted hashes with each encryption run. It is in the responsibility of the calling component to make sure that the password was indeed altered (and that it conforms to any applicable password policy).- Parameter:
username
- the name of the user to updaterestUser
- a Json object containing the modified (and unmodified) attributes- Gibt zurück:
- a response containing a Json object corresponding to the user after modification
- Löst aus:
javax.persistence.EntityNotFoundException
- if no user with the given user name existsIllegalArgumentException
- if any of the input data was invalidUserManager.NotModifiedException
- if the user data was not modified (input data same as database data)
-
countUsers
Count the users matching the specified mission, if any- Parameter:
mission
- the mission code- Gibt zurück:
- the number of users found as string
-