Add group create/modify to webapi.

Review Request #3217 — Created July 13, 2012 and discarded

Information

Review Board

Reviewers

This isn't ready, I'm just posting the RB to get some pointers.

Issues:

1) How to check if group already exists
2) How to add users to new group
3) How to update group
4) How to update users in group

 
Description From Last Updated

I don't beleive this is ever used since no other resources define it. It looks like what you want is …

SM smacleod

You could probably treat this like 'ReviewRequestDraftResource' does. If the group already exists, just treat as an update, not a …

SM smacleod
SM
  1. 1) I think you'll have to make a DB query for this, and check if you find any group objects with the given name. I'm not 100% on this though.
    
    2) I believe this should be done by adding a 'POST' method to the 'ReviewGroupUserResource' (http://www.reviewboard.org/docs/manual/dev/webapi/2.0/resources/review-group-user-list/#webapi2.0-review-group-user-list-resource). The post request will contain the user-id (or maybe the username) to be added to the group. For an example of a resource with a method like this check out the 'create()' method in 'ReviewDiffCommentResource'.
    
    3) This is done in the 'update()' method of the resource. Check out 'ReviewDiffCommentResource' for an example.
    
    4) While investigating this I was coming across some issues. I'm not sure what you should be doing.
    
  2. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
     
    Show all issues
    I don't beleive this is ever used since no other resources define it. It looks like what you want is 'has_modify_permissions', according to the WebAPIResource docstring in Djblets. "has_modify_permissions - Used for HTTP POST or PUT calls, if called by the subclass. Returns False by default."
    
    Your new 'has_modify_permissions' method should take a group, and check if the user can modify it. Look at the other resources for examples of this.
  3. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
    Show all issues
    You could probably treat this like 'ReviewRequestDraftResource' does. If the group already exists, just treat as an update, not a create.
  4. 
      
SH
SH
Review request changed
Status:
Discarded
Change Summary:
There is an error on the RB that is stopping me from updating any of the fields.  Steve helped me enough to move on to other problems, so I'll open a new review later when I have a more solid diff.