Bug 427926 - XMLRPC function getAllGroups
XMLRPC function getAllGroups
Status: CLOSED NEXTRELEASE
Product: Bugzilla
Classification: Community
Component: WebService (Show other bugs)
3.2
All Linux
high Severity medium (vote)
: ---
: ---
Assigned To: David Lawrence
: Reopened
Depends On:
Blocks: RHBZ30UpgradeTracker 406131 427053
  Show dependency treegraph
 
Reported: 2008-01-07 21:04 EST by Noura El hawary
Modified: 2013-06-24 00:18 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-12-01 17:52:42 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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 17:31 EDT, 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 17:35 EDT, David Lawrence
nelhawar: review+
Details | Diff

  None (edit)
Description Noura El hawary 2008-01-07 21:04:43 EST
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 11:02:47 EDT
Currently in CVS and running on bz-web2-test.

Worked 1 hour.
Comment 2 David Lawrence 2008-10-16 16:16:46 EDT
Reopening as this was never converted to 3.2.
Comment 3 David Lawrence 2008-10-16 17:31:21 EDT
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 17:35:22 EDT
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 01:46:23 EST
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 17:52:42 EST
Thanks Noura. Committed to CVS.

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