Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Specification - create a public web service server: Difference between revisions

From MoodleDocs
(Created page with "= Goal = We want a fast server that anybody can request. = similar Hub implementation = We extend the Moodle REST server and overwrite the protected function authenticate_user()...")
 
Line 1: Line 1:
= Goal =
= Goal =
We want a fast server that anybody can request.
We want a fast REST server that anybody can request.


= similar Hub implementation =
= similar Hub implementation =

Revision as of 09:31, 13 February 2012

Goal

We want a fast REST server that anybody can request.

similar Hub implementation

We extend the Moodle REST server and overwrite the protected function authenticate_user().

local/plugins/db/services.php

install the web service functions + the pre-build service

local/plugins/db/install.php

  • create a user (password + username could be set into the plugin admin by the admin)
  • create a role with required capabilities by the web service function
  • also set the webservice/user:rest for this role
  • assign the role to the user on system context
  • create a token for the service/user

local/plugins/server.php:authenticate_user()

Extend the Moodle rest server.

  • load the public token
  • call the normal parent::authenticate_user();