-
Notifications
You must be signed in to change notification settings - Fork 2
Program Manager Permission Issue #533
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
base: main
Are you sure you want to change the base?
Conversation
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.
Just some comments related to the filter. We can reduce the number of times the filter is called by evaluating the permissions once in the views and then passing the value down through the view context.
@@ -19,7 +20,7 @@ | |||
{% block content %} | |||
<h2>Invoices</h2> | |||
<hr /> | |||
{% if not request.org_membership.is_program_manager %} | |||
{% if not request|is_program_manager_for_opportunity:opportunity.id %} |
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.
Can we evaluate this function once in the view and pass this down through the context to use on this page? This will reduce the number of times this function is called.
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.
I see your point, and I partially agree. However, the main reason I implemented this as a template filter was to avoid explicitly passing the value from the view. This allows it to be accessed directly within the template when needed. Additionally, I think calling this function shouldn’t have a performance impact since the request object properties are already pre-cached—or do you see any potential concerns in this regard?
@@ -52,7 +53,7 @@ <h1 class="mb-0">{{ object.name }}</h1> | |||
{% translate "Review User Visits" %} | |||
</a> | |||
</li> | |||
{% if request.org_membership.is_program_manager or request.user.is_superuser %} |
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.
Same comment as above.
@@ -21,7 +22,7 @@ <h2 class="mb-2">User Visit Review</h2> | |||
<form method="get" x-data="" x-ref="reviewFilterForm"> | |||
{% crispy review_filter.form %} | |||
</form> | |||
{% if request.org_membership.is_admin and request.org.program_manager %} |
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.
Same comment as above.
@@ -145,7 +146,7 @@ <h2 class="mb-2">Images</h2> | |||
</dl> | |||
{% endif %} | |||
<div id="action-buttons" style="margin-bottom: 25px;"> | |||
{% if request.org_membership.is_admin and request.org.program_manager or request.org_membership.is_viewer %} | |||
{% if request.org_membership.is_admin and request|is_program_manager_for_opportunity:visit.opportunity.id or request.org_membership.is_viewer %} |
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.
Same comment as above.
Product Description
We had a security issue where an NM organization was also a PM organization in another program. Our current code allowed the NM organization to access all PM functionalities in an opportunity where it was only an NM. This PR fixes that issue.
Technical Summary
CCCT-880
Safety Assurance
Safety story
Tested the views on local.
Automated test coverage
All previous tests are passing
QA Plan
Raised a ticket for QA
Labels & Review