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

🐛 Use froide is_crew helper #616

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions fragdenstaat_de/fds_donation/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from froide.account.auth import try_login_user_without_mfa
from froide.account.models import User
from froide.account.services import AccountService
from froide.helper.auth import is_crew
from froide.helper.email_sending import mail_registry

from fragdenstaat_de.fds_newsletter.utils import subscribe_to_default_newsletter
Expand Down Expand Up @@ -310,12 +311,7 @@ def merge_donor_list(donors):


def confirm_donor_email(donor, request=None):
if (
request
and request.user.is_authenticated
and request.user.is_crew
and request.user != donor.user
):
if request and is_crew(request.user) and request.user != donor.user:
# Don't trigger things as staff for different user
return
is_auth = request and request.user.is_authenticated
Expand Down
4 changes: 2 additions & 2 deletions fragdenstaat_de/fds_paperless/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from froide.foirequest.decorators import allow_write_foirequest
from froide.foirequest.models import FoiRequest
from froide.foirequest.views.list_requests import BaseListRequestView
from froide.helper.auth import require_crew
from froide.helper.auth import is_crew, require_crew
from froide.helper.utils import render_403

from .filters import SelectRequestFilterSet
Expand All @@ -27,7 +27,7 @@ def list_view(request):

@allow_write_foirequest
def add_postal_message(request, foirequest):
if not request.user.is_crew or not request.user.has_perm(
if not is_crew(request.user) or not request.user.has_perm(
"foirequest.change_foimessage"
):
return render_403(request)
Expand Down
20 changes: 10 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ filelock==3.16.0
# virtualenv
fonttools==4.53.1
# via weasyprint
froide @ git+https://github.com/okfde/froide.git@009babab3588e2fc8a70076dbfb3c14db7d872ce
froide @ git+https://github.com/okfde/froide.git@ca284981f637599f4a47f516fe155b7e3e7dd152
# via fragdenstaat-de (pyproject.toml)
froide-campaign @ git+https://github.com/okfde/froide-campaign.git@55a8a36a2ec9862dc160c1f89ed8250229cf55b2
# via fragdenstaat-de (pyproject.toml)
Expand Down
2 changes: 1 addition & 1 deletion requirements-production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ filelock==3.16.0
# triton
fonttools==4.53.1
# via weasyprint
froide @ git+https://github.com/okfde/froide.git@009babab3588e2fc8a70076dbfb3c14db7d872ce
froide @ git+https://github.com/okfde/froide.git@ca284981f637599f4a47f516fe155b7e3e7dd152
# via fragdenstaat-de (pyproject.toml)
froide-campaign @ git+https://github.com/okfde/froide-campaign.git@55a8a36a2ec9862dc160c1f89ed8250229cf55b2
# via fragdenstaat-de (pyproject.toml)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ filelock==3.16.0
# triton
fonttools==4.53.1
# via weasyprint
froide @ git+https://github.com/okfde/froide.git@009babab3588e2fc8a70076dbfb3c14db7d872ce
froide @ git+https://github.com/okfde/froide.git@ca284981f637599f4a47f516fe155b7e3e7dd152
# via fragdenstaat-de (pyproject.toml)
froide-campaign @ git+https://github.com/okfde/froide-campaign.git@55a8a36a2ec9862dc160c1f89ed8250229cf55b2
# via fragdenstaat-de (pyproject.toml)
Expand Down