Skip to content

User Management

js.sevestre edited this page Dec 19, 2019 · 20 revisions

Obtain the apiclient̀ object using the Authentication method explained in Getting Started or in Authentication and connection

List all the users of your Lumapps plateform

api '/user/list' (use pagination)

users = api_client.get_call("user", "list")
# or
users = api_client.get_call("user", "list", showHidden=True)

for user in users:
    print(user.get("uid))

Additional list parameters:

status : enabled or disabled

types : (list) google, microsoft, okta or external.

feeds: (list) id of feeds. response will contain the feeds members.

showHidden : True or False show user hidden from search.

fields : response will contain only specified properties.

users = api_client.get_call("user", "list", fields="items(email, uid)",
print(users)
>>{items: [
>>    {email: "tt@tt.com", uid: "123456789"},
>>    {email: "uu@uu.com", uid: "012345678"},
>>    ...
>>]}

registeredSince : return users registered in the last n days.

Create a user

Save a user by providing %email%, %first_name%, %last_name%

api '/user/save', minimal payload : email , firstName, lastName, and accountType (must be 'external')

user ={
    "email": %email%,
    "firstName": %first_name%,
    "lastName": %last_name%,
    "accountType": "external"
}

# if you want to set a password, add `password` and `rePassword` to the user 

saved_user = api_client.get_call("user", "save", body=user)

saved_user_id, saved_user_name = saved_user.get("id"), saved_user.get("fullName")

print("User {} [{}] saved".format(saved_user_name, saved_user_id))

Update a user

You can update basic information this way :

  • email
  • firstName
  • lastName
  • status (enabled/disabled)
  • isHidden (this correspond to "visible in search and user director" in the admin)

api '/user/get', can by used with email or user uid

api '/user/save', payload, the user object retrieve with user/get call

user = api_client.get_call("user", "get", email="sample@email.com")
# or
user = api_client.get_call("user", "get", uid="123456789")


user['lastName'] = "new lastName"

user = api_client.get_call("user", "save", body=user)

For profile data update, see User Profile Update

For group assignations, see Group Management

Deactivate a user

First get existing user.

user = api_client.get_call("user", "get", email="sample@email.com")
# or
user = api_client.get_call("user", "get", uid="123456789")

Change status

user['status'] = "disabled"

Save

user = api_client.get_call("user", "save", body=user)
Clone this wiki locally