Bug 427926

Summary: XMLRPC function getAllGroups
Product: [Community] Bugzilla Reporter: Noura El hawary <nelhawar>
Component: WebServiceAssignee: David Lawrence <dkl>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: high    
Version: 3.2CC: llu
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-12-01 22:52:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 406071, 406131, 427053    
Attachments:
Description Flags
Patch to re-enable bugzilla.getAllGroups and also adds Group.get 3.X API (v1)
none
Patch to re-enable bugzilla.getAllGroups and also adds Group.get 3.X API (v2) nelhawar: review+

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.