-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat(Proof): improve the permission strategy #603
base: main
Are you sure you want to change the base?
Conversation
- allow anonymous proof upload (a new proof.anonymous field tracks which proof was uploaded by an anonymous user) - allow to retrieve and list all proofs, irrespective of your authentication status - allow users to add a price to a proof they don't own - allow moderators to update/delete a proof Tracking history for the proof table is meant to be made in a future PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry but I think this PR should be split into multiple PRs, too many changes in one go it's hard to review and understand which line does what 😓
I'll start opening PRs in parallel 🙏
@@ -463,12 +463,6 @@ def clean(self, *args, **kwargs): | |||
) | |||
|
|||
if proof: | |||
if proof.owner != self.owner: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not allow users to add prices on proofs they do not own such as RECEIPTs or GDPR_REQUESTs or SHOP_IMPORTs. It should only be possible for PRICE_TAGs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True!
@@ -33,9 +33,14 @@ class Meta: | |||
verbose_name = "User" | |||
verbose_name_plural = "Users" | |||
|
|||
@property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raphodn This is important addition, there was a bug here, because we just checked that the User
instance had a is_authenticated
method when doing if user.is_authenticated
(which is always true)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this requires a dedicated "fix" PR 🙏
and to be tested, because it's probably here for a reason ? (that I can't remember, most likely because of our custom User model & auth) 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method is here because we use it during proof upload. It was a hidden bug, as we used to block all non authenticated requests (but not anymore), so the user was always authenticated.
allow anonymous proof upload (a new proof.anonymous field tracks which proof was uploaded by an anonymous user)allow to retrieve and list all proofs, irrespective of your authentication statusallow users to add a price to a proof they don't ownTracking history for the proof table is meant to be made in a future PR