Provided Methods

  • get user properties by user ID
  • get current user
  • get all users of the domain

Method documentation

All the examples expect that there is already a OneDataApi object initialized and assigned to a variable called "onedata_api".

### Creation of the ONE DATA Api ###
onedata_api = OneDataApi(base_url=base_url, username=user,
password=pw, verify=False, timeout=999)

get

Description

Retrieves a User with the given id XOR by name.

Optional request options (request_transformers, response_transformers, timeout, verify, sleep_after_response_millis, deserializer) can be specified.

Returns: User

Parameters

PropertyTypeRequiredDefaultDescription
idUnion[str, uuid.UUID]falseNoneID of the user
search_in_columnsstrfalseNonefirst name, last name, OR email address must contain this string
force_distinctboolfalseTrueRaise exception if name is ambiguous, False: execute on first match

Usage

### Get User by id ###
user: User = onedata_api.users.get(id=me.id)

### Get User by name ###
result: User= onedata_api.users.get(name="first_name")

paginated

Description

Lists all users matching the specified search parameters (page, limit, sort_by, ordering, group_id, activated, viewer, search).

Optional request options (request_transformers, response_transformers, timeout, verify, sleep_after_response_millis, deserializer) can be specified.

Returns: Paginated

Parameters

PropertyTypeRequiredDefaultDescription
pageintfalseNoneresult page
limitintfalseNoneitems per page
sort_byUserSortPropertyfalseNonesort property
orderingSortOrderfalseNoneorder direction
group_idUnion[str, uuid.UUID]falseNoneID of a group or domain
activatedboolfalseTrueactive users only
viewerboolfalseFalseviewers only
searchstrfalseNonestring to search for desired user. Search is case insensitive. First name, Last name and Email are considered.

Usage

### Get list of user by parameters ###
users = onedata_api.users.paginated(page=0, limit=5, sort_by=UserSortProperty.lastname, ordering=SortOrder.ASC, activated=True, search="Tristan")

me

Description

Retrieves the current User.

Optional request options (request_transformers, response_transformers, timeout, verify, sleep_after_response_millis, deserializer) can be specified.

Returns: User

Parameters: None

Usage

### Get current user ###
me: User = onedata_api.users.me()