Klasse UserManager

java.lang.Object
de.dlr.proseo.usermgr.rest.UserManager

@Component @Transactional(isolation=REPEATABLE_READ) public class UserManager extends Object
Service methods required to manage user accounts.
Autor:
Dr. Thomas Bassler
  • Felddetails

    • userRepository

      @Autowired UserRepository userRepository
      Repository for User objects
  • Konstruktordetails

    • UserManager

      public UserManager()
  • Methodendetails

    • toModelUser

      static User toModelUser(RestUser restUser) throws IllegalArgumentException
      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

      static RestUser toRestUser(User modelUser)
      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

      public RestUser createUser(RestUser restUser) throws IllegalArgumentException
      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 code
      recordFrom - first record of filtered and ordered result to return
      recordTo - 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 mission
      org.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 given
      javax.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 database
      RuntimeException - 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 update
      restUser - 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 exists
      IllegalArgumentException - if any of the input data was invalid
      UserManager.NotModifiedException - if the user data was not modified (input data same as database data)
    • countUsers

      public String countUsers(String mission)
      Count the users matching the specified mission, if any
      Parameter:
      mission - the mission code
      Gibt zurück:
      the number of users found as string