Add channel update API & channel acl update API#35
Add channel update API & channel acl update API#35minghan9456 wants to merge 7 commits intoalfg:masterfrom
Conversation
|
Thank you! Will review soon. |
alfg
left a comment
There was a problem hiding this comment.
Left a few comments. I don't think this is working with the latest build from master, if you can check it out. Thanks.
app/api.py
Outdated
| temporary = request.form.get('temporary') | ||
|
|
||
| if name is not None: | ||
| channel.name = name.encode('utf-8') |
There was a problem hiding this comment.
Hey, have you tried running this with the latest from master? I tried passing name in the form and it errors when trying to set the channel state. It works if I remove the .encode('utf-8) part, though.
There was a problem hiding this comment.
oh
If don't use .encdoe('utf-8'), will get AttributeError: 'unicode' object has no attribute '__dict__'.
But channel name will be updated on mumble client.
My testing command :
curl --location --request PATCH 'http://{ip}:8080/servers/1/channels/13' --form 'name=test'
There was a problem hiding this comment.
I try to use str(name), after updating will getChannelState(channel_id) again for response.
It works.
alfg
left a comment
There was a problem hiding this comment.
Sorry for the delayed response.
The update_channel endpoint looks good. I have some questions on the ACL endpoint, though. Thanks.
| update_acls = origin_acl[0] | ||
| update_groups = origin_acl[1] | ||
| update_inherit = origin_acl[2] |
There was a problem hiding this comment.
Can you explain what's going on here with the ACL settings. It's been a while since I've worked on Murmur Slice API, so I'm a bit rusty. :)
There was a problem hiding this comment.
oh this part, I want to follow RESTful PATCH.
Example :
If this request only pass acls, not pass groups and inherit, will only update acls.
update_groups will be groups of origin_acl, update_inherit will be inherit of origin_acl.
And update_acls will be new_acls
on server.setACL(channel_id, update_acls, update_groups, update_inherit)
| update_groups = origin_acl[1] | ||
| update_inherit = origin_acl[2] | ||
|
|
||
| params = request.get_json() |
There was a problem hiding this comment.
I see you're reading the request JSON body here. However, all of the methods read via multipart form data, so I would rather not change it if possible.
Looking back at the project, I do wish I went with reading the JSON body instead though. 🙂
There was a problem hiding this comment.
It is ok.
I just think json is easy to pass array data like acls or groups.
Because if want to get acls array I need to via request.form.get(acls[][applyHere]) & request.form.get(acls[][applySubs]) and .......
Or have other way can easy to get params.
Can back to use form data.
There was a problem hiding this comment.
here form data with array, you have any idea?
Hey @alfg
This is awesome project.
This is very helpful for me, so I want to share my commit with you.
I add 2 new API about channel
Please check them.