Skip to content

RestApi 1.12.0 Adding multiple groups to user return 400 error. #212

Description

@liolikS

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions