Skip to content

Group Management

js.sevestre edited this page Nov 19, 2019 · 12 revisions

Group in LumApps are named Feeds in the api and object definition.

List

Groups can be defined at platform or instance level.

Get the list of group

api.iter_call('feed', 'list') # platform and instances

api.iter_call('feed', 'list', instance="1234") # one instance

Groups have a type, get details with

api.iter_call('feedtype', 'list') # platform only

api.iter_call('feedtype', 'list', instance="12345") # one one instance

*Note: the ̀iter_call method manage the pagination for you. It returns an python iterator.

Create a group

group = {
    "customer": "123456789",
    "name": "Display name",
    "functionalInnerId": "any, for external use only",
    "type": "12345678", # feed type
    }
}
new_group = api.get_call('feed', 'save', body=group)

Update a group

group = api.get_call('feed', 'get', uid=feedUid)

# change group name then save

group = api.get_call('feed', 'save', body=group)

Delete a group

# user feed/delete with the feed ui

api.get_call('feed', 'delete', uid=feedUid)

Create a group synced with a existing google or microsoft group

You first need to know the identity provider configuration:

idps = api.get_call('customer', 'identityprovider', 'list')

"""
{"items": [
    {
    "name": "customName",
    "domain": "mydomain.net",
    "id": "a913b61f-09ed-4e97-b3ec-cbbf714fe10e",
    "type": "google|microsoft|mail|okta",
    "customerKey": "123456789",
    "nbUsers": 42,
    ...
},
...
]}

"""

Then create a feed:

feed = {
    "customer": "123456789",
    "name": "Display name",
    "groups": [
        {
        "identityProvider": "a913b61f-09ed-4e97-b3ec-cbbf714fe10e",
        "group": "the google email of the group",
        }
    ],
    "functionalInnerId": "any, for external use only",
    "type": "12345678", # feed type
    }
}
new_group = api.get_call('feed', 'save', body=group)

Notes:

  • you can add one group per identity provider. If you try to add more than one group per idp, the last one will be preserved.
  • the group email should exist, in the other case the api will return an error.
  • only google and microsoft idp supports the group synchronization.
  • members are retrieved asynchronously by the server, you may need to wait before doing a member list request to have the full list of members.

List the members of one or many feed

use the user/list endpoint with the feed id in the feeds filter.

feed_members = api.get_call('user', 'list', feeds=['1345'])

update members of a group

body = {
    "feed": "1234",
    "addedUsers":
        [
            "user_email_to add",
            ...
        ],
    "removedUsers":
        [
            "user_email_to remove",
            ...
        ]}
}

api.get_call('feed', 'subscribers', 'save', body=body)