retrieve archive subscriptions through the API

Bug #530315 reported by Diogo Matsubara
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Low
Julian Edwards

Bug Description

Hello,

I'm trying to write a simple script similar to add-apt-repository,
but that it's able to handle private PPAs also.

Exploring the API, I've been able to get the teams for a person
and the PPAs for each team. However, in the PPA (archive) object
I've not been able to get the subscriptions for a person.

It seems it's possible to create a new subscriptions through newSubscription
method, but I'd like to get subscriptions that are already in place
such as the ones obtained in:
https://edge.launchpad.net/~<login>/+archivesubscriptions

Is there any way to do that?

Best regards,
    Javier

Related branches

Revision history for this message
Michael Nelson (michael.nelson) wrote :

This should be as simple as adding and exposing IPerson.getArchiveSubscriptions(include_tokens=False) which calls IArchiveSubscriberSet.getBySubscriber() or getBySubscriberWithActiveToken()

tags: added: trivial
tags: added: p3a
Changed in soyuz:
status: New → Confirmed
Revision history for this message
Julian Edwards (julian-edwards) wrote : Re: [Bug 530315] Re: retrieve archive subscriptions through the API

On Tuesday 02 March 2010 06:27:43 Michael Nelson wrote:
> This should be as simple as adding and exposing
> IPerson.getArchiveSubscriptions(include_tokens=False) which calls
> IArchiveSubscriberSet.getBySubscriber() or
> getBySubscriberWithActiveToken()

I think it would be better to expose a method on IArchive and use CALL_WITH to
provide the currently logged-in user's name.

We need to make sure that we don't expose tokens for the wrong person, so the
security adapter has to be spot on.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

On Tuesday 02 March 2010 09:14:15 Julian Edwards wrote:
> I think it would be better to expose a method on IArchive and use CALL_WITH
> to provide the currently logged-in user's name.

Forgot to say - it could be anonymous API access as well so that would return
nothing.

Changed in soyuz:
status: Confirmed → Triaged
importance: Undecided → Low
tags: added: oem-services
Changed in soyuz:
assignee: nobody → Julian Edwards (julian-edwards)
Changed in soyuz:
status: Triaged → In Progress
Revision history for this message
Ursula Junque (ursinha) wrote : Bug fixed by a commit
Changed in soyuz:
milestone: none → 10.04
status: In Progress → Fix Committed
tags: added: qa-needstesting
Revision history for this message
Javier Collado (javier.collado) wrote :

Thanks for implementing this. It's going to be really useful for me.

I tried to execute the "getArchiveSubscriptionURLs" method for my launchpad user and I got:
HTTP Error 401: Unauthorized

The token that I'me currently using allows the script to read anything (private & public data) is there anything I've missed?

This is exactly what I did in the python interpreter:
> l = launchpadlib.launchpad.Launchpad.login_with('me', launchpadlib.launchpad.EDGE_SERVICE_ROOT)
> l.me.getArchiveSubscriptionURLs()

Revision history for this message
Julian Edwards (julian-edwards) wrote :

The same code works fine for me.

I clicked "change anything" in the auth page though, because the underlying code checks that you have edit permissions on the person to make sure you have enough authority to see the data.

tags: added: qa-ok
removed: qa-needstesting
Revision history for this message
Javier Collado (javier.collado) wrote :

I've tested again with "change anything" permissions and it worked fine. Thanks.

Unfortunately, I've been doing some tests and I'm afraid that the functionality implemented still doesn't help me to completely fix the problem I was trying to solve. The reason for that is that I wasn't specific enough about the task I was trying to carry out.

Let me try to be a little bit more specific now. Thanks to this change, I can get the private PPA subscription data for the logged in user. However, if instead of a subscription, an invitation to a private PPA is pending in the user mailbox, it looks like there's no way to accept that invitation through the API since I'm only able to get the list of subscription URLs. Is that correct? I've seen a method to accept an invitation to become a member of a team, but not to activate a private PPA subscription.

If that's something not difficult to implement, it would be great if you could add also the possiblity to accept a pending invitation for a private PPA so that I can get the subscription URL without the user even accepting the invitation. Thanks.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

Javier, can you file another bug with the specific request please. I'm not sure when it will get done but I hope during the next few cycles.

Changed in soyuz:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.