Answer contacts for packages cannot create/edit FAQs

Bug #682135 reported by Curtis Hovey
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Curtis Hovey

Bug Description

Answer contacts for Ubuntu packages cannot create FAQs. There are cases where the link is shown but the user gets an error when creating the FAQ.

    Module lp.answers.browser.question, line 1199, in create_and_link_action
    faq = self.faq_target.newFAQ(
    Unauthorized: (<Distribution 'Ubuntu' (ubuntu)>, 'newFAQ', 'launchpad.Append')

The fix for this may require changing the security checker or distro or faqtarget mixin to get answer contacts differently. For questions, Lp wants the smallest set, but for faqs, Lp wants the largest set.

This is a regression cause to a refactoring to create simple permission types for registry admins.

Related branches

Curtis Hovey (sinzui)
Changed in launchpad-answers:
status: New → Triaged
importance: Undecided → High
tags: added: regression
affects: launchpad-answers → launchpad-registry
Changed in launchpad-registry:
milestone: none → 10.12
Curtis Hovey (sinzui)
Changed in launchpad-registry:
assignee: nobody → Curtis Hovey (sinzui)
status: Triaged → In Progress
Curtis Hovey (sinzui)
summary: - Conflicting launchpad.Append rules for IDistribution and IFaqTarget
+ Answer contacts for packages cannot create/edit FAQs
affects: launchpad-registry → launchpad-answers
Changed in launchpad-answers:
assignee: Curtis Hovey (sinzui) → nobody
milestone: 10.12 → none
description: updated
Curtis Hovey (sinzui)
tags: added: 403
removed: regression
Revision history for this message
Curtis Hovey (sinzui) wrote :

This has been broken for several years. The problem is in the security checker. The checker is based on the question checker (answer_contacts), but the set of permitted user is larger. Distribution users who can edit an FAQ are comprised of distro answer_contacts + the answer_contacts of all the packages.

That is a lot of inTeam() checks across a lot of packages. There is an alternate way to solve this that will involve exactly two queries regardless of the number of packages and answer_contacts. The checker can get the user's direct and indirect questiontargets that the user is an answer contact for and compare them to the context.

faq_target = IFAQTarget(context)
for target in direct_targets + indirect_target:
    if faq_target == IFAQTarget(target):
        return True
return False

Curtis Hovey (sinzui)
tags: added: answer-contacts
tags: added: faqs
Curtis Hovey (sinzui)
Changed in launchpad-answers:
assignee: nobody → Curtis Hovey (sinzui)
Revision history for this message
Launchpad QA Bot (lpqabot) wrote : Bug fixed by a commit
tags: added: qa-needstesting
Changed in launchpad-answers:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
tags: added: qa-ok
removed: qa-needstesting
Curtis Hovey (sinzui)
Changed in launchpad:
status: Fix Committed → Fix Released
Curtis Hovey (sinzui)
Changed in launchpad:
milestone: none → 11.01
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

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