webservices user as site administrator

webservices user as site administrator

by john saylor -
Number of replies: 1

does anyone have any comments on making the webservices user a site administrator?

i keep running into problems with context, for instance assigning roles. i'm also digging down into permissions and configuration to try and do this a different way, but so far, the different way has brought me precious little success. so it seems like i might be headed here anyway.

Average of ratings: -
In reply to john saylor

Re: webservices user as site administrator

by Jérôme Mouneyrac -
Hi John,
from what I understand, you created a Moodle user (and so a token) for your client. By principe I would avoid using a token linked to an administrator as much as I can (imagine a client user steals the token, then the Moodle admin add the delete_courses() function to the service thinking it's ok because he knows the client doesn't call it, then the user deletes the Moodle site courses with its own client)

In summary you must know about the administration of Moodle roles (one of the most difficult part in administration imo). It is very likely that the issue you are having, you are having it in Moodle too. The core web service respect 100% (otherwise it's a bug) the web behaviour. So if you can/cannot do something on the web, it will be the same with the web services. You have to know how to administrate when you are using the web services. There is no other choice that reading docs and testing on the web version.

Note: assign_role is tricky by the name. You may be looking to enrol_users instead, search in this forum there are few conversations about it.

Cheers,
Jerome