About role_assignments table

About role_assignments table

by Mandeep Maurya -
Number of replies: 2

In which case the contextid added in role_assignments table when we enroll a user from a user group to a learning plan points to CONTEXT_BLOCK instead of CONTEXT_COURSE. I'm not able to replicate this scenario. Please help out with this.

Average of ratings: -
In reply to Mandeep Maurya

Re: About role_assignments table

by Joost Elshoff -
Picture of Particularly helpful Moodlers Picture of Testers
If I understand your question correctly, this is what you should know about the mdl_role_assignments table:

The contextid refers to the id of the specific context a role was assigned, in the mdl_contexts table. In that table, you can also find the context level, which can be SYSTEM, COURSECAT, COURSE, ...
In reply to Joost Elshoff

Re: About role_assignments table

by Mandeep Maurya -
Hi Joost,
Yes, I'm aware of that. To be more clear about the issue what I'm facing. I have a Learning plan with 5 courses and a user group with 10 members. When I enroll that user group to that LP. In role_assignments table for one particular user, 4 out of 5 courses have context_id referring to CONTEXT_COURSE but for 1 course the context id is pointing to CONTEXT_BLOCK. I just wanted to know in what case this going to happen.