Status

()

bugzilla.mozilla.org
API
RESOLVED FIXED
2 years ago
11 months ago

People

(Reporter: mcote, Assigned: dkl)

Tracking

Production

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

2 years ago
We need an API to get user information for the currently logged-in user, particularly from an API key.
(Assignee)

Comment 1

2 years ago
taking so no one else will work on this at the same time as myself
Assignee: nobody → dkl
Status: NEW → ASSIGNED
(Assignee)

Comment 2

2 years ago
Created attachment 8661025 [details] [diff] [review]
1204683_1.patch
Attachment #8661025 - Flags: review?(glob)
Comment on attachment 8661025 [details] [diff] [review]
1204683_1.patch

Review of attachment 8661025 [details] [diff] [review]:
-----------------------------------------------------------------

::: Bugzilla/WebService/User.pm
@@ +437,5 @@
> +    return filter $params, {
> +        id        => $self->type('int', $user->id),
> +        real_name => $self->type('string', $user->name),
> +        name      => $self->type('email', $user->login),
> +        email     => $self->type('email', $user->email),

this should match User.get, and return just id, real_name, and name (ie. return $user->email as 'name').

@@ +1116,5 @@
> +=item C<login> (string) - The user's login name.
> +
> +=item C<password> (string) - The user's password.
> +
> +=item C<token> (string) - The user's login token.

none of these are parameters for this method - they are standard auth params.

just document this as a method that doesn't take any params.

@@ +1128,5 @@
> +=over
> +
> +=item id
> +
> +C<int> The unique integer ID that Bugzilla uses to represent this user. 

remove trailing space

@@ +1142,5 @@
> +
> +=item name
> +
> +C<string> The login name of the user. Note that in some situations this is 
> +different than their email.

it's always their email address on bmo - no need for that 2nd sentence (applies to .rst too)

@@ +1170,5 @@
> +=item B<History>
> +
> +=over
> +
> +=item API call was added in Bugzilla B<4.2>.

remove this - it doesn't make any sense with bmo's versioning scheme.
Attachment #8661025 - Flags: review?(glob) → review-
(Assignee)

Comment 4

2 years ago
Created attachment 8665117 [details] [diff] [review]
1204683_2.patch
Attachment #8661025 - Attachment is obsolete: true
Attachment #8665117 - Flags: review?(glob)

Comment 5

2 years ago
I see this bug is for BMO, so maybe my comment doesn't apply because, I'm looking at upstream, but perhaps this patch should also update the "Authentication Delegation via API Keys" docs page to suggest using this new 'whoami' endpoint rather than the "valid_login" one. As seen in bullet point #3 here:

http://bugzilla.readthedocs.org/en/latest/integrating/auth-delegation.html#auth-delegation

bugzilla/docs/en/rst/integrating/auth-delegation.rst
Comment on attachment 8665117 [details] [diff] [review]
1204683_2.patch

Review of attachment 8665117 [details] [diff] [review]:
-----------------------------------------------------------------

(In reply to leifer from comment #5)
> I see this bug is for BMO, so maybe my comment doesn't apply because, I'm
> looking at upstream, but perhaps this patch should also update the
> "Authentication Delegation via API Keys" docs page to suggest using this new
> 'whoami' endpoint rather than the "valid_login" one. As seen in bullet point
> #3 here:
> 
> http://bugzilla.readthedocs.org/en/latest/integrating/auth-delegation.
> html#auth-delegation

excellent point - our docs are at http://bmo.readthedocs.org/en/latest/integrating/auth-delegation.html#auth-delegation
dkl - while you're updating that file, please change 'bugs.example.org' to 'bugzilla.mozila.org' :)

r=glob with these documentation changes.

::: Bugzilla/WebService/User.pm
@@ +1107,5 @@
> +logged in user.
> +
> +=item B<Params>
> +
> +Standard API authentication parameters.

the auth params apply to all methods, so it doesn't make sense to call them out explicitly here (this method doesn't take any params).

i suspect the point you're trying to make is you need to authenticate somehow to use this method - state that in the description rather than in the params docs.
Attachment #8665117 - Flags: review?(glob) → review+
(Assignee)

Comment 7

2 years ago
To ssh://gitolite3@git.mozilla.org/webtools/bmo/bugzilla.git
   89e6553..923afd7  master -> master
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED

Comment 8

11 months ago
Is this feature planned to go into upstream Bugzilla too?
Blocks: 1307003
You need to log in before you can comment on or make changes to this bug.