Skip to content

Introduce CourseContextRoleListener to dynamically assign contextual course roles#8491

Draft
AngelFQC wants to merge 30 commits into
chamilo:masterfrom
AngelFQC:8486-cidreq
Draft

Introduce CourseContextRoleListener to dynamically assign contextual course roles#8491
AngelFQC wants to merge 30 commits into
chamilo:masterfrom
AngelFQC:8486-cidreq

Conversation

@AngelFQC
Copy link
Copy Markdown
Member

No description provided.

@AngelFQC AngelFQC linked an issue May 25, 2026 that may be closed by this pull request
5 tasks
@AngelFQC AngelFQC force-pushed the 8486-cidreq branch 2 times, most recently from 67f4417 to 3cc5eb6 Compare May 26, 2026 00:17
AngelFQC added 9 commits May 29, 2026 18:58
…RRENT_COURSE_STUDENT` and `ROLE_CURRENT_COURSE_SESSION_STUDENT`)
… `CreateDocumentFileAction` to prevent IDOR vulnerabilities
…or cleaner context management in `DocumentCollectionStateProvider`
…andling with parameterized context management.
…ateCBlogAction` to prevent bypassing course, session, or group access gates.
AngelFQC and others added 17 commits May 30, 2026 00:31
Remove the platform-wide ROLE_TEACHER fallback from the create/import/export
operations (it allowed any teacher of the platform to operate on any course),
and add a contextual read role to the GetCollection that previously relied on
the default ROLE_USER firewall check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the platform-wide ROLE_TEACHER fallback from the create/export operations
and add a contextual read role to the GetCollection that previously relied on
the default ROLE_USER firewall check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ions

Drop the platform-wide ROLE_TEACHER fallback from the create operation and add
a contextual read role to the GetCollection that previously relied on the
default ROLE_USER firewall check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…I operations

Replace the lax ROLE_USER check on the item Get with an object-level VIEW on the
resource node, and add a contextual read role to the GetCollection (CidFilter
already scopes results to the requested course).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ions

Replace the lax ROLE_USER on the item Get with an object-level VIEW, add a
contextual read role to the GetCollection, and swap the platform-wide
ROLE_TEACHER/ROLE_ADMIN check on create and reorder for contextual teacher
roles (admins keep access via the role hierarchy).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…operations

Add a contextual read role to the GetCollection (replacing the lax ROLE_USER)
and drop the platform-wide ROLE_TEACHER fallback from the create operation.

The /upload operation (ROLE_STUDENT / ROLE_STUDENT_BOSS) is intentionally left
unchanged: switching it to contextual roles would change who can submit
assignments and affect student-boss supervisors, which needs a separate decision.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the lax ROLE_USER on the comment list and upload operations with
contextual course/session read roles. The Delete operation keeps its
owner-only check (object.getUser() == user), which is already stricter.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the lax ROLE_USER on the tool-intro list with contextual course/session
read roles (CidFilter already scopes results to the requested course). Item
operations already use object-level checks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the lax ROLE_USER on the blog-post list with contextual course/session
read roles. Item operations already gate through the parent blog's resource node.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the lax ROLE_USER on the blog-comment list with contextual
course/session read roles. Item operations already gate through the parent
blog/post resource node.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ations

Align the blog-task operations with the rest of the blog module: gate item
reads/writes through the parent blog's resource node (plus author ownership for
patch/delete), add a contextual read role to the GetCollection, and require
EDIT on the blog to create a task. Removes the lax ROLE_USER and the
platform-wide ROLE_TEACHER/ROLE_ADMIN fallbacks (admins keep access via the
role hierarchy).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the lax ROLE_USER on the blog-membership list with contextual
course/session read roles. Write operations already gate through the parent
blog's resource node.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Gate item reads and creates through the parent blog's resource node, add a
contextual read role to the GetCollection, and require course membership for
the upload endpoint (was IS_AUTHENTICATED_REMEMBERED). Removes the lax ROLE_USER.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the resource-wide ROLE_USER with contextual course/session roles so
ratings can only be listed and submitted by members of the current course.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Gate item reads through the parent blog's resource node, add a contextual read
role to the GetCollection, and replace the platform-wide ROLE_TEACHER/ROLE_ADMIN
fallbacks on create/patch with contextual teacher roles (the patch keeps its
owner check; admins keep access via the role hierarchy).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the platform-wide ROLE_TEACHER fallback on the correction upload with
contextual course/session teacher roles.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…vel roles

Gate the item Get through the parent publication's resource node, add a
contextual read role to the GetCollection, and drop the platform-wide
ROLE_TEACHER fallback from create/delete in favour of contextual teacher roles.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AngelFQC and others added 4 commits May 30, 2026 00:56
…roles

Gate the item Get through the parent publication's resource node, add a
contextual read role to the GetCollection and resource-level fallback, and
replace the platform-wide ROLE_TEACHER/ROLE_SESSION_MANAGER checks on
create/delete with contextual teacher roles.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a contextual course/session read role to the course-tools list, which
previously relied on the default ROLE_USER firewall check (CidFilter already
scopes results to the requested course).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a contextual course/session read role to the groups list, which previously
relied on the default ROLE_USER firewall check. The item Get already uses an
object-level VIEW on the resource node.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the very lax IS_AUTHENTICATED_REMEMBERED check on the dropbox upload
with contextual course/session roles, so only members of the current course
can share files through the dropbox.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: dedicated listener for ROLE_CURRENT_COURSE_* assignment

1 participant