Closed mikuamuro closed 5 years ago
Got it working with this:
def remove_user_from_group(self, username, groupname, raise_on_error=False):
"""Remove a user from a group
:param username: The username to remove from the group
:param groupname: The group name to be removed from the user
:return: True on success, False on failure.
"""
response = self._delete(self.rest_url + "/group/user/direct",params={"username": username, "groupname": groupname})
print response
if response.status_code == 204:
return True
if raise_on_error:
raise RuntimeError(response.json()['message'])
return False
Hi @mikuamuro , Were you planning to submit the suggested code change above as a pull request?
If not, I'm curious to understand why the code would be shared in this format, but not as a PR? I'm new-ish here and would like to know if this a common workflow. Thank you.
Thanks @mikuamuro for the example code. I've been using it for a while and it works fine.
Pull request #48 was submitted and approved to add remove_user_from_group functionality.
Resolved by #48. Thank you!
Would it be possible to implement "remove direct group membership" via the python client? (As I noted that no delete had been implemented so far ... )
Here is the restfulAPI from Crowd: https://docs.atlassian.com/atlassian-crowd/3.1.1/REST/#usermanagement/1/group-removeDirectGroupMembership
Thanks!