o365-moodle
o365-moodle copied to clipboard
Extra owners added to "group" after course creation in Moodle.
This may be a configuration in our organisation, but I wouldn't know which, you may be able to point me in the right direction. Though it could also be a strange thing happening:
When creating a new course, and adding a teacher to it, and then running the \local_o365\task\coursesync task, a new team and group are created, but 3 additional users are added to it, besides the teacher.
Such additional users are managers in our organisation, this is why I suspect it could be a configuration, I just don't know which one.
Hi @iorobertob,
Could you provide the following information please.
- Moodle version.
- local_o365 plugin version.
- The "Connection method" configured in the Microsoft 365 Integration page, i.e. Application access or System API user.
- Regarding the three additional users:
- Are they enrolled in the courses?
- Are they enrolled in the parent context, e.g. course categories, of the courses?
- Do they have any roles in the courses?
- Do they get any role assignments from the parent categories of the courses?
I may have more questions based on the answers to the questions, but these should be the starting point of the investigation.
Regards, Lai
Hi @weilai-irl , thanks for your response! So, I looked at the plugin code a bit and figured out why and how to change things, I will detail at the bottom, but anyway i include the extra information needed:
- Moodle == 4.0.2
- local_o365 == 4.0.1 2022041905
- Connection method == Application
- Regarding users:
- Not enrolled in the courses
- Not enrolled in parent context
- They do not have roles in the course per se (they do have the general "Manager" role
So, the reason was that these users had the role of Managers and in the roles' capabilities, "Team owner" (local/o365:teamowner) is allowed, which adds these users as owners of all teams/groups, and therefor they are added with the cron task.
I think this solves the whole issues, so I write it here so that the record remains.
Hi @iorobertob,
Thank you so much for reporting back. Your findings are absolutely correct - those users were added as Team owner because they have the "Team owner" (local/o365:teamowner) capability from the "manager" role.
This does raise an issue - a user should only be treated as a team owner if (1) the user has the capability in the course context, and (2) the user is enrolled in the course. The plugin was implemented this way before, and I believe it was the March 2022 release, which included the Teams integration rewriting, broke this. I'll fix the logic in the next release.
Regards, Lai
Hi all,
The fix to this issue has been included in the release from today. Please upgrade your plugins to see the changes.
I'm going to close the issue now.
Regards, Lai