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
pillar_privacy_filters = ''
1407
if features.getFeatureFlag(
1408
'disclosure.private_bug_visibility_rules.enabled'):
1409
pillar_privacy_filters = """
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
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
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
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)
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
1420
""" % sqlvalues(personid=user.id),
1421
_make_cache_user_can_view_bug(user))
1460
personid=quote(user.id),
1461
extra_filters=pillar_privacy_filters)
1462
return query, _make_cache_user_can_view_bug(user)
1424
1465
def build_tag_set_query(joiner, tags):