Closed patrick-cichon-gcx closed 1 year ago
Great work @patrick-cichon-gcx :-) I assume you are using this enhancement productively at your end and it works? Currently I can't test it live on our Docuware system, hence my question.
I have only a few small suggestions for changes: According to PEP8, CamelCase should only be used on class names, not variables or functions. Please change the names of the parameters to snake_case.
In activate_user() you split the username into first and last name by cutting it apart at a single dot. I think the convention "firstname.lastname" is common, but probably not enforced anywhere. We should use a more robust method to separate the name. For example something like that:
name_parts = user_name.rsplit('.', 1)
if len(name_parts) > 1:
first_name = name_parts[0]
last_name = name_parts[1]
else:
first_name = ""
last_name = user_name
Hey @sniner, thanks for looking at my code! Ok, I'll change the parameters to snake_case.
Regarding the split of first and last name: I agree your solution is more robust. I worked it into the script. I'll open the PR this afternoon probably, I'm currently finishing up.
Yes, I tested the changes productively and they worked well on my end.
EDIT: I just commited the changes to this PR. I'm not sure but I think I do not need to open a new PR as you can view the changes in this PR. Let me know if this is not correct then I'll open a new PR.
Thanks @patrick-cichon-gcx for contributing to the project with this PR. I will upload the new version to PyPI next weekend.
Hey @sniner,
in context of issue #1 I added the following functionality to the
client
library:Get user
user = org.get_user('Ingo.Ittmann')
Get user listuserList = org.get_user_list()
Create userresponse = org.create_user(createDict
) Info: An example for the structure of the createDict can be found in the functions description. Deactivate userresponse = org.deactivate_user("Ingo.Ittmann")
Activate userresponse = org.activate_user('Ingo.Ittmann')
Get group
group = org.get_group('Erfasser')
Get group listgroupList = org.get_group_list()
Add group to userresponse = org.add_group_to_user('Sales', 'Ingo.Ittmann')
Remove group from userresponse = org.remove_group_from_user('Sales', 'Ingo.Ittmann')
In order to achieve some of the above functionality it was necessary to create functions to execute PUT requests against the DocuWare API. These functions have been added to the
conn
library.