Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store phonenumbers somewhere #102

Merged
merged 2 commits into from
Aug 7, 2020
Merged

Store phonenumbers somewhere #102

merged 2 commits into from
Aug 7, 2020

Conversation

hmpf
Copy link
Contributor

@hmpf hmpf commented Aug 6, 2020

Part of #97.

@hmpf hmpf requested a review from ddabble August 6, 2020 09:14
@codecov-commenter
Copy link

codecov-commenter commented Aug 6, 2020

Codecov Report

Merging #102 into master will increase coverage by 0.88%.
The diff coverage is 91.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #102      +/-   ##
==========================================
+ Coverage   73.08%   73.96%   +0.88%     
==========================================
  Files          32       34       +2     
  Lines        1211     1260      +49     
==========================================
+ Hits          885      932      +47     
- Misses        326      328       +2     
Impacted Files Coverage Δ
src/argus/auth/models.py 83.33% <77.77%> (-16.67%) ⬇️
src/argus/auth/views.py 83.33% <90.90%> (+11.90%) ⬆️
src/argus/auth/admin.py 100.00% <100.00%> (ø)
src/argus/auth/serializers.py 100.00% <100.00%> (ø)
src/argus/auth/urls.py 100.00% <100.00%> (ø)
src/argus/ws/__init__.py 100.00% <0.00%> (ø)
src/argus/ws/models.py 100.00% <0.00%> (ø)
src/argus/incident/fields.py 89.47% <0.00%> (+2.63%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f58b94a...fbdf519. Read the comment docs.

src/argus/auth/admin.py Outdated Show resolved Hide resolved
@hmpf hmpf requested a review from ddabble August 6, 2020 10:26
src/argus/auth/models.py Outdated Show resolved Hide resolved
@hmpf
Copy link
Contributor Author

hmpf commented Aug 7, 2020

I've squashed some things and force pushed. New stuff: checking for ownership in the viewset.

@hmpf hmpf requested a review from ddabble August 7, 2020 07:12

class PhoneNumberViewSet(ModelViewSet):
permission_classes = [IsAuthenticated, IsOwner]
queryset = PhoneNumber.objects.all()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be better in our case if we defined this method instead of queryset:

def get_queryset(self):
    return self.request.user.phone_numbers.all()

In that case, we might as well remove the IsOwner permission, but on the other hand, it could be nice to keep it to be explicit. Any thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to manually test :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've force-pushed a fix for this, after testing. I've also rebased on the drf-permissions merge-point.

@ddabble ddabble merged commit 1371939 into Uninett:master Aug 7, 2020
@hmpf hmpf deleted the phonenumber branch August 13, 2020 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants