imaging_api.routers.users ========================= .. py:module:: imaging_api.routers.users Attributes ---------- .. autoapisummary:: imaging_api.routers.users.XNAT_URL imaging_api.routers.users.router imaging_api.routers.users.XNATAuthHeaders Functions --------- .. autoapisummary:: imaging_api.routers.users.get_users imaging_api.routers.users.create_user_endpoint imaging_api.routers.users.update_user_profile imaging_api.routers.users.add_user_to_project_endpoint Module Contents --------------- .. py:data:: XNAT_URL .. py:data:: router .. py:data:: XNATAuthHeaders .. py:function:: get_users(headers: XNATAuthHeaders) -> list[imaging_api.routers.schemas.User] Get a list of all users on XNAT. :param headers: XNAT authentication headers injected via FastAPI dependency. :type headers: XNATAuthHeaders :returns: All users currently registered on the XNAT instance. :rtype: list[imaging_api.routers.schemas.User] .. py:function:: create_user_endpoint(user: imaging_api.routers.schemas.CreateUser, headers: XNATAuthHeaders) -> imaging_api.routers.schemas.User Creates a new user on XNAT. :param user: User data to create. :type user: imaging_api.routers.schemas.CreateUser :param headers: XNAT authentication headers. :type headers: XNATAuthHeaders :returns: The created user profile. :rtype: imaging_api.routers.schemas.User :raises HTTPException: If there is an error during the creation of the user. .. py:function:: update_user_profile(update_profile_request: imaging_api.routers.schemas.UpdateUser, headers: XNATAuthHeaders) -> imaging_api.routers.schemas.User Updates the profile of a user on XNAT. :param update_profile_request: User data to update. :type update_profile_request: imaging_api.routers.schemas.UpdateUser :param headers: XNAT authentication headers. :type headers: XNATAuthHeaders :returns: The updated user profile. :rtype: imaging_api.routers.schemas.User :raises HTTPException: If there is an error during the update of the user profile or if the request cannot be processed. .. py:function:: add_user_to_project_endpoint(username: str, project_id: str, headers: XNATAuthHeaders) -> imaging_api.routers.schemas.User Adds an XNAT user to a project. In XNAT, username is unique, so it can be used to identify the user. If you try to add a user with an existing username, XNAT will return an error. The error message will look like this: "ERROR: The username {username} is already in use. Please enter a different username value and try again." Added checks to ensure the user exists and is enabled before adding them to the project. This is not something that is done in the XNAT function. :param username: The username of the user to add. :type username: str :param project_id: The ID of the project to add the user to. :type project_id: str :param headers: XNAT authentication headers. :type headers: XNATAuthHeaders :returns: The updated user profile. :rtype: imaging_api.routers.schemas.User :raises HTTPException: If there is an error getting the user profile or if there is an error adding the user to the :raises project.: