-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(members): List global role members in Prod and ProdType #10850
feat(members): List global role members in Prod and ProdType #10850
Conversation
DryRun Security SummaryThe pull request introduces global roles and permissions, enhances authorization and permissions logic, and updates the product and product type views to display global members, groups, and benchmark progress, with the goal of improving the authorization and permissions management system for product types, products, and their associated members and groups. Expand for full summarySummary: The code changes in this pull request are focused on improving the authorization and permissions management system for product types, products, and their associated members and groups. The key changes include:
Files Changed:
Overall, these changes are focused on improving the authorization and permissions management system, which is a crucial aspect of application security. It's important to thoroughly review the implementation and test the changes to ensure that there are no unintended security implications, such as potential privilege escalation or unauthorized access vulnerabilities. Code AnalysisWe ran
Riskiness🟢 Risk threshold not exceeded. |
992ab8b
to
a5a54b4
Compare
931caee
to
5f76229
Compare
0081f6a
to
6c9d104
Compare
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.
Approved
6c9d104
to
295b47a
Compare
dojo/product/queries.py
Outdated
if user.is_superuser or user_has_permission(user, product, permission): | ||
return Global_Role.objects.filter(group=None).order_by("user__first_name", "user__last_name").select_related("role", "user") | ||
else: | ||
return None |
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.
It looks like this includes users who have the global role "None" that do not actually have access to a Product?
Also, shouldn't we return something like an empty list here instead of None
? I believe this conditional in the template:
{% if product_groups or product_type_groups or global_product_groups %}
Could result in a "NoneType object is not iterable" error when trying to loop over it here if global_product_groups
is None
but one of the other 2 values is non-None
:
{% for type_group in global_product_groups %}
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 forgot about these cases. Thank you.
I thought that the unsettling Global role, record was removed.
I would prefer ...objects.none()
instead. To keep the same data-type as the return type.
In if
s it is evaluated as False
and there is no problem with iterations:
>>> bool(Product_Type_Member.objects.none())
False
>>> for i in Product_Type_Member.objects.none():
... print(i)
...
>>>
295b47a
to
ff1c4d5
Compare
ff1c4d5
to
d3298d1
Compare
d3298d1
to
344dcde
Compare
Until now, UI listed only regular members of Prod or ProdType. From now on, owners of Prods are transparently informed that also
Global_Role
members also have access to their data.In ProdType:
In Prod: