com_courses: let admins view course forms instead of 422ing them out - #1921
Open
denphi wants to merge 1 commit into
Open
com_courses: let admins view course forms instead of 422ing them out#1921denphi wants to merge 1 commit into
denphi wants to merge 1 commit into
Conversation
Form::execute() resolved a #__courses_members row at section then offering
scope and aborted 422 "No user found" when neither matched. Site admins and
course managers who are not enrolled have no such row, so any form task --
including a read-only PDF layout view reached from the outline builder --
turned them away.
authorize() already exempts Super Administrators, and the manager check it
performs is access('manage'), not membership. But authorize() runs inside the
task and execute() gets there first, so that exemption was never reachable.
execute() now applies the same test: a user with no member row is let through
when they are a super admin or can manage the course, with $this->member left
null and $this->unenrolled set.
$this->member is only consumed by showDeployment, complete, startWork,
saveProgress and submit, so those five now assert it themselves. An admin can
lay out and read a form but still cannot deploy one or submit responses, which
keeps respondent records tied to real members. The authoring tasks (layout,
index, upload, saveLayout) never read it.
The layout view shows a warning when unenrolled. It has to render in the view
rather than through Notify: this route is requested with tmpl=component, and
neither the form views nor the component template render the notification
queue, so a Notify call would silently surface on some later page.
Ticket: https://nanohub.org/support/ticket/510363
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Form::execute() resolved a #__courses_members row at section then offering scope and aborted 422 "No user found" when neither matched. Site admins and course managers who are not enrolled have no such row, so any form task -- including a read-only PDF layout view reached from the outline builder -- turned them away.
authorize() already exempts Super Administrators, and the manager check it performs is access('manage'), not membership. But authorize() runs inside the task and execute() gets there first, so that exemption was never reachable.
execute() now applies the same test: a user with no member row is let through when they are a super admin or can manage the course, with $this->member left null and $this->unenrolled set.
$this->member is only consumed by showDeployment, complete, startWork, saveProgress and submit, so those five now assert it themselves. An admin can lay out and read a form but still cannot deploy one or submit responses, which keeps respondent records tied to real members. The authoring tasks (layout, index, upload, saveLayout) never read it.
The layout view shows a warning when unenrolled. It has to render in the view rather than through Notify: this route is requested with tmpl=component, and neither the form views nor the component template render the notification queue, so a Notify call would silently surface on some later page.
Ticket: https://nanohub.org/support/ticket/510363