atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.29k stars 642 forks source link

confluence.add_user_to_group is wrong #1422

Open Mauwork opened 1 week ago

Mauwork commented 1 week ago

https://github.com/atlassian-api/atlassian-python-api/blob/42ed0b022ec5d13416d79f4118e655f536247d07/atlassian/confluence.py#L3062 This function is using the wrong URL and it should be a "PUT" not a "POST" see: https://docs.atlassian.com/ConfluenceServer/rest/8.2.0/#api/user/{username}/group/{groupName}-update Fix that should work:

def add_user_to_group(self, username, group_name):
        """
        Add given user to a group

        :param username: str - username of user to add to group
        :param group_name: str - name of group to add user to
        :return: Current state of the group
        """
       url = f"rest/api/user/{username}/group/{group_name}"
       return self.put(url)
gonchik commented 2 days ago

Hi @Mauwork , first of all, thank you for your detection. please send PR

Mauwork commented 2 days ago

PR: https://github.com/atlassian-api/atlassian-python-api/pull/1425