-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Open
Copy link
Description
Update all usages of the has_access function to use a single call with a list for sec_permission instead of two separate calls joined by an or statement. For example, refactor:
has_access(request.user.id, auth_obj) or has_access(request.user.id, "scoutadmin")to:
has_access(request.user.id, [auth_obj, "scoutadmin"])The has_access function has already been modified to accept a list or single parameter for sec_permission. Only update the usages throughout the codebase on the update-has-access branch that currently use multiple calls joined by or.
Relevant Code References
Below are code snippets showing current usages of has_access. Refactor any instances where two calls are joined by or (these are likely found in your codebase, including these files):
Example Function Implementation
# ...
def has_access(user_id, sec_permission):
# ...Usage Examples
- scouting/strategizing/views.py
- scouting/strategizing/views.py
- scouting/strategizing/views.py
- scouting/views.py
- scouting/views.py
- scouting/views.py
- scouting/admin/views.py
- attendance/views.py
- tba/views.py
- tba/views.py
- form/views.py
- user/views.py
See these files for likely locations containing patterns such as:
has_access(request.user.id, X) or has_access(request.user.id, Y)Replace with:
has_access(request.user.id, [X, Y])- Search and refactor all such instances in the codebase.
- Ensure that the updated code is functionally identical to the old logic, just consolidated into a single call.
- Test all changes to confirm no regressions in access control logic.
Metadata
Metadata
Assignees
Labels
No labels