I need to create a plugin that automatically creates a role based on the Moodle admin role but with less capabilities for the purpose of a school internship. So far I have done several researches but I do not find concretely what I want.
I also tried to get inspired by the source code of Moodle.
To add a new role, we will have to follow this path: Site Administration -> Users -> Define roles and choose "Add a new role"
and the url is "localhost/mymoodle/admin/roles/define.php?action=add" but after choosing the role it inherits, the path is "localhost/mymoodle/admin/roles/define.php" and it comes with the capabilities of the model role.
It is almost not possible to create it automatically.
I don't really understand the source code inside. I really need your help.