In my moodle site, I have a manager account creating course content. I also have a teacher user definition profile. Users with the teacher profile belong to certain groups. Lets say I have teacher 1 belonging to Group 1. The course has Group 1 and Group 2. Whenever the manager creates a new activity, I want every group in the site to have access to it and since the activity will not have have restrict access enabled, this should work as expected. However, if a teacher profile creates an activity, I want the activity to automatically be restricted to be only visible to the group they belong to. Basically I want the activity creation to automatically check the current user role and the group and include it as a restrict access condition and hide the activity for those not matching the restriction. How can I go about doing this?
One possible way to do this is to make a local plugin which will "listen" to course_module_created event and add restriction to just created activity
Great suggestion. I'll look into this. Any particular plugin I can look into to make it easier for me to understand how to go about this? I'm pretty new to this.
- groups were developed to group students - not teachers. So first you will have to avoid that teachers can modify/add groups.
- restrictions were also not developed to restrict teachers. So you will need to rewrite user restrictions.
- last but not least you want to give teachers permissions to create new activities but also restrict them to edit other ones. To have this functionality, you will need a herd of programmers to add a new edit_module permission to Moodle.
Yeah. You are right. In this case, to truly implement "restriction" I would have to go down that path. I'm going to just setup "hurdles" for now to improve the user experience. In other words, If a spirited teacher wanted, they might be able to make changes by regrouping and other crafty ways or removing restriction manually.