There is a problem when creating a user and assigning groups to them. When creating a user, it is created normally, but when changing or adding groups to it, I get error 400 The ofrestapi python module is used. All I mean is that one group is added and everything is fine, but adding multiple groups at once is broken.
my code using for my site and openfire restapi
def add_user_groups(self, username, groups):
> Add user to one or more groups
>
> :param username: The user name
> :param groups: One or more groups to be added in
> :type groups: List of strings. E.g. ['Admins','Friends']
>
endpoint = '/'.join([self.endpoint, username, 'groups'])
payload = {
'groupname': groups,
}
return self._submit_request(post, endpoint, json=payload)
This code return 400 error
This code work fine (after add new code for aditing one group to user):
def add_user_group(self, username, group):
"""
Add user to one group
:param username: The user name
:param group: One group to be added in
:type groups: List of strings. E.g. ['Admins','Friends']
"""
endpoint = '/'.join([self.endpoint, username, 'groups', group])
return self._submit_request(post, endpoint)
There is a problem when creating a user and assigning groups to them. When creating a user, it is created normally, but when changing or adding groups to it, I get error 400 The ofrestapi python module is used. All I mean is that one group is added and everything is fine, but adding multiple groups at once is broken.
my code using for my site and openfire restapi
This code return 400 error
This code work fine (after add new code for aditing one group to user):