|
Moodle
2.2.1
http://www.collinsharper.com
|
Go to the source code of this file.
| enum RPC_FORBIDDENMETHOD |
| enum RPC_NOSUCHCLASS |
| enum RPC_NOSUCHFILE |
| enum RPC_NOSUCHFUNCTION |
| enum RPC_NOSUCHMETHOD |
| enum RPC_OK |
| _mnet_field_helper | ( | mnet_peer $ | peer, |
| $ | key | ||
| ) |
helper for {
private
| mnet_peer | $peer | the peer object |
| string | $key | 'import' or 'export' |
Definition at line 853 of file lib.php.


| mnet_debug | ( | $ | debugdata, |
| $ | debuglevel = 1 |
||
| ) |
Output debug information about mnet. this will go to the error_log.
| mixed | $debugdata | this can be a string, or array or object. |
| int | $debuglevel | optional , defaults to 1. bump up for very noisy debug info |
Definition at line 537 of file lib.php.


| mnet_encrypt_message | ( | $ | message, |
| $ | remote_certificate | ||
| ) |
Encrypt a message and return it in an XML-Encrypted document
This function can encrypt any content, but it was written to provide a system of encrypting XML-RPC request and response messages. The message will be base64 encoded, so it does not need to be text - binary data should work.
We compute the SHA1 digest of the message. We compute a signature on that digest with our private key. We link to the public key that can be used to verify our signature. We base64 the message data. We identify our wwwroot - this must match our certificate's CN
The XML-RPC document will be parceled inside an XML-SIG document, which holds the base64_encoded XML as an object, the SHA1 digest of that document, and a signature of that document using the local private key. This signature will uniquely identify the RPC document as having come from this server.
See the { http://www.w3.org/TR/xmlenc-core/ XML-ENC spec} at the W3c site
| string | $message | The data you want to sign |
| string | $remote_certificate | Peer's certificate in PEM format |
Definition at line 253 of file lib.php.


| mnet_fields_to_import | ( | mnet_peer $ | peer | ) |
return an array of the profile fields to import from the given host, when creating/updating user accounts
| mnet_peer | $peer | the peer we're getting the information from |
Definition at line 839 of file lib.php.


| mnet_fields_to_send | ( | mnet_peer $ | peer | ) |
return an array of the profile fields to send with user information to the given mnet host.
| mnet_peer | $peer | the peer to send the information to |
Definition at line 827 of file lib.php.


| mnet_generate_keypair | ( | $ | dn = null, |
| $ | days = 28 |
||
| ) |
Generate public/private keys and store in the config table
Use the distinguished name provided to create a CSR, and then sign that CSR with the same credentials. Store the keypair you create in the config table. If a distinguished name is not provided, create one using the fullname of 'the course with ID 1' as your organization name, and your hostname (as detailed in $CFG->wwwroot).
| array | $dn | The distinguished name of the server |
Definition at line 339 of file lib.php.


| mnet_get_app_jumppath | ( | $ | applicationid | ) |
| mnet_get_hostname_from_uri | ( | $ | uri = null | ) |
Strip extraneous detail from a URL or URI and return the hostname
| string | $uri | The URI of a file on the remote computer, optionally including its http:// prefix like http://www.example.com/index.html |
Definition at line 32 of file lib.php.

| mnet_get_hosts | ( | $ | withdeleted = false | ) |
| mnet_get_keypair | ( | ) |
Get your SSL keys from the database, or create them (if they don't exist yet)
Get your SSL keys from the database, or (if they don't exist yet) call mnet_generate_keypair to create them
| string | $string | The text you want to sign |
Definition at line 312 of file lib.php.

| mnet_get_peer_host | ( | $ | mnethostid | ) |
| mnet_get_public_key | ( | $ | uri, |
| $ | application = null |
||
| ) |
Get the remote machine's SSL Cert
| string | $uri | The URI of a file on the remote computer, including its http:// or https:// prefix |
Definition at line 45 of file lib.php.


| mnet_get_service_info | ( | mnet_peer $ | mnet_peer, |
| $ | fulldata = true |
||
| ) |
return an array information about services enabled for the given peer. in two modes, fulldata or very basic data.
| mnet_peer | $mnet_peer | the peer to get information abut |
| boolean | $fulldata | whether to just return which services are published/subscribed, or more information (defaults to full) |
Definition at line 702 of file lib.php.

Return an array of information about all moodle's profile fields which ones are optional, which ones are forced. This is used as the basis of providing lists of profile fields to the administrator to pick which fields to import/export over MNET
Definition at line 575 of file lib.php.

| mnet_set_public_key | ( | $ | uri, |
| $ | key = null |
||
| ) |
Store a URI's public key in a static variable, or retrieve the key for a URI
| string | $uri | The URI of a file on the remote computer, including its https:// prefix |
| mixed | $key | A public key to store in the array OR null. If the key is null, the function will return the previously stored key for the supplied URI, should it exist. |
Definition at line 153 of file lib.php.

| mnet_sign_message | ( | $ | message, |
| $ | privatekey = null |
||
| ) |
Sign a message and return it in an XML-Signature document
This function can sign any content, but it was written to provide a system of signing XML-RPC request and response messages. The message will be base64 encoded, so it does not need to be text.
We compute the SHA1 digest of the message. We compute a signature on that digest with our private key. We link to the public key that can be used to verify our signature. We base64 the message data. We identify our wwwroot - this must match our certificate's CN
The XML-RPC document will be parceled inside an XML-SIG document, which holds the base64_encoded XML as an object, the SHA1 digest of that document, and a signature of that document using the local private key. This signature will uniquely identify the RPC document as having come from this server.
See the { http://www.w3.org/TR/xmldsig-core/ XML-DSig spec} at the W3c site
| string | $message | The data you want to sign |
| resource | $privatekey | The private key to sign the response with |
Definition at line 189 of file lib.php.


| mnet_sso_apply_indirection | ( | $ | jumpurl, |
| $ | url | ||
| ) |
Inline function to modify a url string so that mnet users are requested to log in at their mnet identity provider (if they are not already logged in) before ultimately being directed to the original url.
| string | $jumpurl | the url which user should initially be directed to. This is a URL associated with a moodle networking peer when it is fulfiling a role as an identity provider (IDP). Different urls for different peers, the jumpurl is formed partly from the IDP's webroot, and partly from a predefined local path within that webwroot. The result of the user hitting this jump url is that they will be asked to login (at their identity provider (if they aren't already)), mnet will prepare the necessary authentication information, then redirect them back to somewhere at the content provider(CP) moodle (this moodle) |
| array | $url | array with 2 elements 0 - context the url was taken from, possibly just the url, possibly href="url" 1 - the destination url |
| mnet_strip_user | ( | $ | user, |
| $ | fields | ||
| ) |
given a user object (or array) and a list of allowed fields, strip out all the fields that should not be included. This can be used both for outgoing data and incoming data.
| mixed | $user | array or object representing a database record |
| array | $fields | an array of allowed fields (usually from mnet_fields_to_{send,import} |
Definition at line 877 of file lib.php.

| mnet_update_sso_access_control | ( | $ | username, |
| $ | mnet_host_id, | ||
| $ | accessctrl | ||
| ) |