Functions for working with DSpace Users.
In DSpace-speak a user is called an "EPerson".
Summary
Functions
Creates a new user.
Deletes a user permanently.
Fetches a single user by UUID.
Fetches a user by their email address.
Finds users by Metadata.
Lists all users from the repository.
Lists groups that a user is a direct member of.
Replaces an user.
Updates an existing user.
Functions
@spec create( map(), keyword() ) :: DSpace.API.Operation.t()
Creates a new user.
This operation requires administrator privileges.
Required user data:
"email"- User's email address (must be unique within the system)"metadata"- Map containing user metadata
Parameters
user_data- Map containing user data and metadata
Examples
user_data = %{
"email" => "newuser@example.com",
"metadata" => %{
"eperson.firstname" => [%{"value" => "John"}],
"eperson.lastname" => [%{"value" => "Doe"}]
},
"canLogIn" => true,
"requireCertificate" => false
}
{:ok, created_user} =
User.create(user_data) |> DSpace.API.request(client)
@spec delete( binary(), keyword() ) :: DSpace.API.Operation.t()
Deletes a user permanently.
When a user is deleted, the system handles various references through cascading operations:
- Items submitted by the user have their submitter set to null
- Items in the user's workspace are deleted entirely
- Resource policies are removed
- Workflow tasks are unclaimed or deleted
- Group memberships are removed
This operation has the following constraints:
- Requires administrator privileges
- You can't delete users if it would leave workflow groups empty
Parameters
uuid- The UUID of the user to delete
@spec fetch( binary(), keyword() ) :: DSpace.API.Operation.t()
Fetches a single user by UUID.
@spec fetch_by_email(binary()) :: DSpace.API.Operation.t()
Fetches a user by their email address.
Parameters
email- The email address of the user to fetch
@spec find(keyword()) :: DSpace.API.Operation.t()
Finds users by Metadata.
This operation can be streamed.
Options
:search_term- general search term:page- Page number (0-based, defaults to 0):size- Number of items per page (usually defaults to 20)
@spec list(keyword()) :: DSpace.API.Operation.t()
Lists all users from the repository.
This operation can be streamed.
Options
:page- Page number (0-based, defaults to 0):size- Number of items per page (usually defaults to 20)
@spec list_groups( binary(), keyword() ) :: DSpace.API.Operation.t()
Lists groups that a user is a direct member of.
This operation can be streamed.
Parameters
uuid- The UUID of the useroptions- Additional options for pagination
Options
:page- Page number (0-based, defaults to 0):size- Number of items per page (usually defaults to 20)
@spec replace(binary(), map(), keyword()) :: DSpace.API.Operation.t()
Replaces an user.
Replaces all user data with the provided data.
This operation requires administrator privileges.
Parameters
uuid- The UUID of the user to replaceuser_data- Complete user data map
@spec update(binary(), list(), keyword()) :: DSpace.API.Operation.t()
Updates an existing user.