428
428
api_request = IWebServiceClientRequest(request)
429
429
is_distro = IDistribution.providedBy(context)
430
430
if user is not None:
431
for team in user.getAdministratedTeams():
432
# If the context is a distro AND a bug supervisor is set AND
433
# the admininistered team is not a member of the bug supervisor
435
if (is_distro and context.bug_supervisor is not None and
436
not team.inTeam(context.bug_supervisor)):
439
'link': absoluteURL(team, api_request),
441
'url': canonical_url(team),
431
administrated_teams = list(user.getAdministratedTeams())
432
if administrated_teams:
433
# Get this only if we need to.
434
membership = list(user.teams_participated_in)
435
for team in administrated_teams:
436
# If the user is not a member of the team itself, then skip it,
437
# because structural subscriptions and their filters can only be
438
# edited by the subscriber.
439
# This can happen if the user is an owner but not a member.
440
if not team in membership:
442
# If the context is a distro AND a bug supervisor is set AND
443
# the admininistered team is not a member of the bug supervisor
445
if (is_distro and context.bug_supervisor is not None and
446
not team.inTeam(context.bug_supervisor)):
449
'link': absoluteURL(team, api_request),
451
'url': canonical_url(team),
443
453
IJSONRequestCache(request).objects['administratedTeams'] = info