the thing is... you don't assign global roles using an enrolment plugin. You use an authentication plugin instead.
Even if enrolment was performed using roles in Moodle from 1.7.x to 1.9.x, they were conceptually two different things. From Moodle 2.0.x on, they are actually two different things implementationwise (albeit related).
Enrolment only makes sense for (normal) courses, while you can assign roles pretty much everywhere. But the site course is special in this regard. It's not a normal course, in that you don't have sections, can't place activities (other than a 'section 0' forum), doesn't have a grade book, etc. And enrolment is mainly about that: being able to carry activities out and being graded. That's why the enrolment code treats the site course in a that special way.
On the other hand, if you want some users to have special roles in the whole site, that's ok as far as Moodle concerns. But you do so by assigning those roles in the site course, not by enrolling them in the site course. And as I said before, you can do that using an authentication plugin. Right now the only two auth plugins that can assign roles are FirstClass and LDAP. They currently only assign the course creator role, but they could be extented to assign any role (in fact, MDL-30634 proposes an enhancement for LDAP to do so)
How to assign global user roles with external database enrolment plugin.
This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.