Bug 427926 - XMLRPC function getAllGroups
Summary: XMLRPC function getAllGroups
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Bugzilla
Classification: Community
Component: WebService
Version: 3.2
Hardware: All
OS: Linux
high
medium
Target Milestone: ---
Assignee: David Lawrence
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: RHBZ30UpgradeTracker 406131 427053
TreeView+ depends on / blocked
 
Reported: 2008-01-08 02:04 UTC by Noura El hawary
Modified: 2013-06-24 04:18 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-12-01 22:52:42 UTC
Embargoed:


Attachments (Terms of Use)
Patch to re-enable bugzilla.getAllGroups and also adds Group.get 3.X API (v1) (7.99 KB, patch)
2008-10-16 21:31 UTC, David Lawrence
no flags Details | Diff
Patch to re-enable bugzilla.getAllGroups and also adds Group.get 3.X API (v2) (8.87 KB, patch)
2008-10-16 21:35 UTC, David Lawrence
nelhawar: review+
Details | Diff

Description Noura El hawary 2008-01-08 02:04:43 UTC
write xmlrpc function getAllGroups that is to be contributed to the upstream.
Please refer to the following url for details on Bugzilla::RPC 2.18 functions mapped to upstream Bugzilla::WebService and for 2.18 xmlrpc functions sorted by percentage of calls: https://engineering.redhat.com/trac/bugzilla-3.0-rh/wiki/XmlrpcCrossComparison#a2.18xmlrpcfunctionssortedbypercentageofcalls

Comment 1 David Lawrence 2008-04-01 15:02:47 UTC
Currently in CVS and running on bz-web2-test.

Worked 1 hour.

Comment 2 David Lawrence 2008-10-16 20:16:46 UTC
Reopening as this was never converted to 3.2.

Comment 3 David Lawrence 2008-10-16 21:31:21 UTC
Created attachment 320611 [details]
Patch to re-enable bugzilla.getAllGroups and also adds Group.get 3.X API (v1)

Attaching a patch that reenables the bugzilla.getAllGroups from 2.18 and uses
Bugzilla::Group->get_all. Also added new Bugzilla::WebService::Group which essentially adds a similar function but uses the 3.X API and also allows for filtering group list by ids or names.

Please review

Dave

Comment 4 David Lawrence 2008-10-16 21:35:22 UTC
Created attachment 320613 [details]
Patch to re-enable bugzilla.getAllGroups and also adds Group.get 3.X API (v2)

Oops, left out needed changes to xmlrpc.cgi in the last patch. Submitting fixed patch for review.

Comment 5 Noura El hawary 2008-11-27 06:46:23 UTC
Comment on attachment 320613 [details]
Patch to re-enable bugzilla.getAllGroups and also adds Group.get 3.X API (v2)

Hi Dave,

Patch looks good to me tested it and it works fine, only few comments inline.


> 
>Index: Bugzilla/WebService/Group.pm
>===================================================================

>+=item B<Errors>
>+
>+=over
>+
>+=item 51 (Invalid Object)
>+
>+A non existing group name was passed to the function, as a result no 
>+group object existed for that invalid name.
>+

I think we can also add here an error for the case if the user is not in the creatgroups group as the following:

=item 304 (Authorization Required)

Logged-in users are not authorized to edit bugzilla groups as they are not members
of the creategroups group in bugzilla.



>+=back
>+
>+=back
>+
>+=back
>+
>Index: extensions/compat_xmlrpc/code/webservice.pl
>===================================================================
>+sub getAllGroups {
>+    my ($self, $username, $password) = @_;
>+
>+    # Try to login if $username and $password provided.
>+    xmlrpc_client_login($username, $password, LOGIN_REQUIRED);
>+
>+    $logger->debug("Starting: $username");
>+    
>+    Bugzilla->user->in_group('editusers')

I think this should be 
Bugzilla->user->in_group('creategroups');


>+        || ThrowUserError("auth_failure", {group  => "creategroups",
>+                                           action => "edit",
>+                                           object => "groups"});
>+    
>

Comment 6 David Lawrence 2008-12-01 22:52:42 UTC
Thanks Noura. Committed to CVS.


Note You need to log in before you can comment on or make changes to this bug.