-
Notifications
You must be signed in to change notification settings - Fork 6
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
[#2023] Implemented Category/Product admin access based on auth.Group #967
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #967 +/- ##
===========================================
- Coverage 94.77% 94.74% -0.04%
===========================================
Files 861 863 +2
Lines 30192 30388 +196
===========================================
+ Hits 28614 28790 +176
- Misses 1578 1598 +20 ☔ View full report in Codecov by Sentry. |
22645c8
to
4b49cd4
Compare
When I try to edit a category via the CMS without permission, I am redirected to the admin and get the following message:
That's misleading. Perhaps change the message to indicate that the user has no permission. |
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.
A group user who is not part of a group with access to category X can still view and change X (or any other category) by assigning the permission pdc | Product | Can change product
to themselves.
It would be best to just hide the permission section from the admin for group users (only show it to superusers).
|
@@ -95,6 +96,52 @@ def test_user_cannot_publish_child_category_without_root_published_on_list_page( | |||
updated_category = Category.objects.get(slug="bar4") | |||
self.assertFalse(updated_category.published) | |||
|
|||
def test_access_limited_to_linked_auth_groups(self): |
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 think we're missing a testcase to verify that a user with managed categories cannot see/edit the access_groups
field on the Category
change page
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 added this test (even though it is now readonly)
693d142
to
bc29efa
Compare
… Product has at least one category
bc29efa
to
c96e2f0
Compare
task: https://taiga.maykinmedia.nl/project/open-inwoner/task/2023
To make this work create a Group in the admin and assign some Categories. Then assign this Group to a non-superuser, and login as this User.
Then in the Category list view you'll only see this category, and in the Product list view you only see Product from this Category. Additionally in the Product edit view you can only assign Categories from your Groups (there is some logic to keep assigned Categories you're not allowed to manage)..