• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / fx-private-relay / f23a5195-b8cc-4af7-8b41-d16c19e122d0

21 Jun 2024 03:58PM CUT coverage: 85.346% (-0.02%) from 85.369%
f23a5195-b8cc-4af7-8b41-d16c19e122d0

Pull #4798

circleci

jwhitlock
Remove more Profile.objects.get(user=user)
Pull Request #4798: MPP-4763 - Prefer `user.profile` to `Profile.objects.get(user=user)`

3979 of 5111 branches covered (77.85%)

Branch coverage included in aggregate %.

83 of 84 new or added lines in 7 files covered. (98.81%)

1 existing line in 1 file now uncovered.

15712 of 17961 relevant lines covered (87.48%)

10.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.91
/api/permissions.py
1
from rest_framework import permissions
1✔
2
from waffle import flag_is_active
1✔
3

4
READ_METHODS = ["GET", "HEAD"]
1✔
5

6

7
class IsOwner(permissions.BasePermission):
1✔
8
    def has_object_permission(self, request, view, obj):
1✔
9
        return obj.user == request.user
1✔
10

11

12
class HasPremium(permissions.BasePermission):
1✔
13
    def has_permission(self, request, view):
1✔
14
        if request.method in READ_METHODS:
×
15
            return True
×
NEW
16
        return request.user.profile.has_premium
×
17

18

19
class HasPhoneService(permissions.BasePermission):
1✔
20
    def has_permission(self, request, view):
1✔
21
        if request.method in READ_METHODS:
1✔
22
            return True
1✔
23
        return request.user.profile.has_phone
1✔
24

25

26
class CanManageFlags(permissions.BasePermission):
1✔
27
    def has_permission(self, request, view):
1✔
28
        return flag_is_active(request, "manage_flags") and request.user.email.endswith(
×
29
            "@mozilla.com"
30
        )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc