-
Notifications
You must be signed in to change notification settings - Fork 24
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
base: main
Are you sure you want to change the base?
Conversation
self.user: True, | ||
self.admin: True, | ||
self.admin2: False, | ||
self.customer_support: 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.
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: |
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.
because org.get_user_role
no longer fakes an Admin role for staff
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.
@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) |
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.
doesn't appear to be used anywhere....
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
No description provided.