Repository navigation
fix: Studio v3 home: no write on GET, no-op org, public schema - #39310
Faraz32123 wants to merge 5 commits into
Conversation
With ENABLE_CREATOR_GROUP on, reading the home page inserted an 'unrequested' CourseCreator row for a non-staff user without one. The status is now reported as 'unrequested' without a write, and the row is created when the user requests access. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The list action never loads courses, so org had no effect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v1 home is public, and v3 home is its replacement. ADR 0038 allows x-internal only for the unversioned course_home BFF, and lists Studio home among the screen names to replace, not to mark internal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| user = CourseCreator.objects.get(user=user) | ||
| # Created as 'unrequested' and then saved as 'pending', so that the change | ||
| # of state notifies the admins. | ||
| user, _ = CourseCreator.objects.get_or_create(user=user) |
There was a problem hiding this comment.
get_or_create turns a request that used to fail into one that writes. Before this change, a user with no row hit DoesNotExist here (a 500, nothing written). The only users without rows were global staff, and everyone on a site with ENABLE_CREATOR_GROUP off or DISABLE_COURSE_CREATION on.
Now any logged-in user who POSTs to /request_course_creator gets a pending row, and the admins get an email. That includes:
- global staff, whom
_add_userdeliberately never adds; - sites with the creator group off;
- sites with course creation disabled, where the request can never be granted.
Could this be a no-op in the cases where _get_course_creator_status never reads the table? Something like:
if (
user.is_staff
or getattr(settings, 'DISABLE_COURSE_CREATION', False)
or not getattr(settings, 'ENABLE_CREATOR_GROUP', False)
):
returnPlease also add a test for each of the three cases. test_user_requested_access_without_an_entry would then need @override_settings(ENABLE_CREATOR_GROUP=True) instead of relying on the default.
There was a problem hiding this comment.
Good catch, done. user_requested_access is now a no-op for staff, with the creator group off, and with course creation disabled, the cases where _get_course_creator_status never reads the table. Added a test for each, and test_user_requested_access_without_an_entry (and the old test_user_requested_access) now set ENABLE_CREATOR_GROUP=True explicitly.
| # Add the user to the course creator admin table with status 'unrequested'. | ||
| add_user_with_status_unrequested(user) | ||
| course_creator_status = get_course_creator_status(user) | ||
| course_creator_status = get_course_creator_status(user) or CourseCreator.UNREQUESTED |
There was a problem hiding this comment.
On the side effect in the description: I think this needs a decision before merge rather than a note. CourseCreatorAdmin returns False from has_add_permission and keeps username read-only, so an admin can no longer grant creator access to someone who hasn't requested it. Operators who pre-approve staff or instructors today lose that workflow.
Two options I can see:
- allow adding rows in the admin, with
usereditable only on the add form; - keep the behaviour and add an operator-facing release note saying users appear in the admin only after they request access.
I'd lean towards the first, since it keeps the old capability without bringing back the write on GET.
There was a problem hiding this comment.
Agreed, went with the first option. Staff can add rows in the admin now; user is picked by id on the add form and stays read-only on the change form. Added a test that adds a user who never requested access as granted through the admin and checks they land in the creator group. I've dropped the side-effect note from the description.
Staff, sites with the creator group off, and sites with course creation disabled never read the CourseCreator table, so a request there no longer creates a pending row or emails the admins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rows are no longer created when a user opens Studio home, so admins need a way to grant access to someone who has not requested it. The user is picked by id on the add form and stays read-only afterwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes the v3 home issues raised on #39263, so it can serve as the public replacement for
GET /api/contentstore/v1/home.ENABLE_CREATOR_GROUPon, loading Studio home (v1, v3 and the legacy page) inserted anunrequestedCourseCreatorrow for non-staff users. The status is now reported asunrequestedwithout a write, andrequest_course_creatorcreates the row when the user asks for access. It's created asunrequestedand then saved aspending, so the admin notification still fires.orgremoved from the v3 homelistschema. That action never loads courses, so the parameter did nothing.x-internal. v1 home is public and v3 is its replacement. ADR 0038 allowsx-internalonly for the unversionedcourse_homeBFF, and lists Studiohomeamong the screen names to replace. This removes it from both mounts. The legacy/api/contentstore/v3/home/was public before feat: apply ADR 0038 (URL structure standardization) across 6 standardized APIs #39078 and stays deprecated.Course creator requests and the admin.
request_course_creatordoes nothing for staff, with the creator group off, or with course creation disabled, since the table isn't read there. Staff can now addCourseCreatorrows in the admin (user picked by id on the add form, read-only after), so admins can still grant access to someone who hasn't requested it.Testing: course creators, v1/v3 home, spectacular, library and course-creation tests pass locally. New tests fail without the fix. The generated CMS schema has no
x-internaloperations, and/api/authoring/v3/home/keeps its SDK tag.docs/cms-openapi.yamlis left to the schema workflow.Note: #39300 removes the hook block from
cms/envs/devstack.pyandproduction.py; whichever lands second drops the comment edit there.Related: #39263, #39068
🤖 Generated with Claude Code