~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/model/bugtask.py

[r=sinzui][bug=702429] Bugtask pillar owners can see private bugs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1403
1403
    # part of the WHERE condition (i.e. the bit below.) The
1404
1404
    # other half of this condition (see code above) does not
1405
1405
    # use TeamParticipation at all.
1406
 
    return ("""
 
1406
    pillar_privacy_filters = ''
 
1407
    if features.getFeatureFlag(
 
1408
        'disclosure.private_bug_visibility_rules.enabled'):
 
1409
        pillar_privacy_filters = """
 
1410
             UNION
 
1411
             SELECT BugTask.bug
 
1412
             FROM BugTask, TeamParticipation, Product
 
1413
             WHERE TeamParticipation.person = %(personid)s AND
 
1414
                   TeamParticipation.team = Product.owner AND
 
1415
                   BugTask.product = Product.id AND
 
1416
                   BugTask.bug = Bug.id AND
 
1417
                   Bug.security_related IS False
 
1418
             UNION
 
1419
             SELECT BugTask.bug
 
1420
             FROM BugTask, TeamParticipation, ProductSeries
 
1421
             WHERE TeamParticipation.person = %(personid)s AND
 
1422
                   TeamParticipation.team = ProductSeries.owner AND
 
1423
                   BugTask.productseries = ProductSeries.id AND
 
1424
                   BugTask.bug = Bug.id AND
 
1425
                   Bug.security_related IS False
 
1426
             UNION
 
1427
             SELECT BugTask.bug
 
1428
             FROM BugTask, TeamParticipation, Distribution
 
1429
             WHERE TeamParticipation.person = %(personid)s AND
 
1430
                   TeamParticipation.team = Distribution.owner AND
 
1431
                   BugTask.distribution = Distribution.id AND
 
1432
                   BugTask.bug = Bug.id AND
 
1433
                   Bug.security_related IS False
 
1434
             UNION
 
1435
             SELECT BugTask.bug
 
1436
             FROM BugTask, TeamParticipation, DistroSeries, Distribution
 
1437
             WHERE TeamParticipation.person = %(personid)s AND
 
1438
                   TeamParticipation.team = Distribution.owner AND
 
1439
                   DistroSeries.distribution = Distribution.id AND
 
1440
                   BugTask.distroseries = DistroSeries.id AND
 
1441
                   BugTask.bug = Bug.id AND
 
1442
                   Bug.security_related IS False
 
1443
        """ % sqlvalues(personid=user.id)
 
1444
    query = """
1407
1445
        (Bug.private = FALSE OR EXISTS (
1408
1446
             SELECT BugSubscription.bug
1409
1447
             FROM BugSubscription, TeamParticipation
1416
1454
             WHERE TeamParticipation.person = %(personid)s AND
1417
1455
                   TeamParticipation.team = BugTask.assignee AND
1418
1456
                   BugTask.bug = Bug.id
 
1457
             %(extra_filters)s
1419
1458
                   ))
1420
 
                     """ % sqlvalues(personid=user.id),
1421
 
        _make_cache_user_can_view_bug(user))
 
1459
        """ % dict(
 
1460
                personid=quote(user.id),
 
1461
                extra_filters=pillar_privacy_filters)
 
1462
    return query, _make_cache_user_can_view_bug(user)
1422
1463
 
1423
1464
 
1424
1465
def build_tag_set_query(joiner, tags):