-
Notifications
You must be signed in to change notification settings - Fork 0
Crls/deny publish action for staff #69
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: open-release/teak.nelp
Are you sure you want to change the base?
Changes from 2 commits
1c114c2
b219dd1
379238b
9a5352e
ef8b9cf
5281d21
e479076
a43e9a3
96a324e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| from .course_rerun import CourseRerunView | ||
| from .course_waffle_flags import CourseWaffleFlagsView | ||
| from .course_team import CourseTeamView | ||
| from .course_user_role import CourseUserRoleView | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you use it?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's used. Registered in urls.py at the route course_user_role/{COURSE_ID_PATTERN}, making it an active API endpoint accessible at /api/contentstore/v1/course_user_role/{course_id} |
||
| from .grading import CourseGradingView | ||
| from .group_configurations import CourseGroupConfigurationsView | ||
| from .help_urls import HelpUrlsView | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -46,6 +46,8 @@ | |||||
| has_studio_read_access, | ||||||
| has_studio_write_access, | ||||||
| ) | ||||||
| from common.djangoapps.student.models import CourseAccessRole | ||||||
| from common.djangoapps.student.roles import GlobalStaff | ||||||
| from common.djangoapps.util.date_utils import get_default_time_display | ||||||
| from common.djangoapps.util.json_request import JsonResponse, expect_json | ||||||
| from openedx.core.djangoapps.bookmarks import api as bookmarks_api | ||||||
|
|
@@ -172,6 +174,43 @@ def handle_xblock(request, usage_key_string=None): | |||||
| ) | ||||||
| if not access_check(request.user, usage_key.course_key): | ||||||
| raise PermissionDenied() | ||||||
|
|
||||||
| # Debug logging to see what's in the request | ||||||
| log.info(f"=== XBLOCK REQUEST DEBUG === method={request.method}, user={request.user.username}, usage_key={usage_key}") | ||||||
| log.info(f"request.json exists: {hasattr(request, 'json')}, request.json value: {getattr(request, 'json', None)}") | ||||||
|
|
||||||
| # Check if user is trying to publish and if they have permission | ||||||
| if request.method in ("POST", "PUT", "PATCH"): | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why |
||||||
| try: | ||||||
| publish_action = request.json.get("publish") if hasattr(request, 'json') and request.json else None | ||||||
|
||||||
| publish_action = request.json.get("publish") if hasattr(request, 'json') and request.json else None | |
| publish_action = request.json.get("publish") if hasattr(request, "json") and request.json else None |
single or double quotes
Outdated
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.
| role__in=['instructor', 'staff'] | |
| role__in=['instructor', 'staff'], |
Outdated
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.
Why are you using _?
Outdated
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.
Broad exception
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.
CourseUserRoleSerializerDo you need it?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.
Yes, needed. It's used by CourseUserRoleView to serialize the response data.