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

Restrict staff servicing org perms to non-POST requests #5620

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rowanseymour
Copy link
Member

No description provided.

self.user: True,
self.admin: True,
self.admin2: False,
self.customer_support: True,
Copy link
Member Author

Choose a reason for hiding this comment

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

staff servicing perms now happens at view level only and not in User.has_org_perm which this is testing

# only editors and administrators can use API tokens
if role not in APIToken.ALLOWED_ROLES:
# only editors, administrators and servicing staff can use API tokens
if role not in APIToken.ALLOWED_ROLES and not request.user.is_staff:
Copy link
Member Author

Choose a reason for hiding this comment

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

because org.get_user_role no longer fakes an Admin role for staff

Copy link
Member Author

Choose a reason for hiding this comment

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

@ericnewcomer @norkans7 we should maybe stop relying on staff API tokens for dashboards.. we could have a special U-Report account which we add to workspaces instead.

@@ -42,10 +42,6 @@ def __call__(self, request):
assert hasattr(request, "user"), "must be called after django.contrib.auth.middleware.AuthenticationMiddleware"

request.org = self.determine_org(request)
if request.org:
# set our current role for this org
request.role = request.org.get_user_role(request.user)
Copy link
Member Author

Choose a reason for hiding this comment

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

doesn't appear to be used anywhere....

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (81d26e6) to head (b98b517).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #5620   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          560       560           
  Lines        25755     25752    -3     
=========================================
- Hits         25755     25752    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

1 participant