imaging_api.routers.users
Attributes
Functions
|
Get a list of all users on XNAT. |
|
Creates a new user on XNAT. |
|
Updates the profile of a user on XNAT. |
Adds an XNAT user to a project. |
Module Contents
- imaging_api.routers.users.XNAT_URL
- imaging_api.routers.users.router
- imaging_api.routers.users.XNATAuthHeaders
- imaging_api.routers.users.get_users(headers: XNATAuthHeaders) list[imaging_api.routers.schemas.User]
Get a list of all users on XNAT.
- Parameters:
headers (XNATAuthHeaders) – XNAT authentication headers injected via FastAPI dependency.
- Returns:
All users currently registered on the XNAT instance.
- Return type:
- imaging_api.routers.users.create_user_endpoint(user: imaging_api.routers.schemas.CreateUser, headers: XNATAuthHeaders) imaging_api.routers.schemas.User
Creates a new user on XNAT.
- Parameters:
user (imaging_api.routers.schemas.CreateUser) – User data to create.
headers (XNATAuthHeaders) – XNAT authentication headers.
- Returns:
The created user profile.
- Return type:
- Raises:
HTTPException – If there is an error during the creation of the user.
- imaging_api.routers.users.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.
- Parameters:
update_profile_request (imaging_api.routers.schemas.UpdateUser) – User data to update.
headers (XNATAuthHeaders) – XNAT authentication headers.
- Returns:
The updated user profile.
- Return type:
- Raises:
HTTPException – If there is an error during the update of the user profile or if the request cannot be processed.
- imaging_api.routers.users.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.
- Parameters:
username (str) – The username of the user to add.
project_id (str) – The ID of the project to add the user to.
headers (XNATAuthHeaders) – XNAT authentication headers.
- Returns:
The updated user profile.
- Return type:
- Raises:
HTTPException – If there is an error getting the user profile or if there is an error adding the user to the
project. –