Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mnet/lib.php File Reference

Go to the source code of this file.

Namespaces

namespace  mnet

Enumerations

enum  RPC_OK
 CONSTANTS ///////////////////////////////////////////////////////////. More...
enum  RPC_NOSUCHFILE
enum  RPC_NOSUCHCLASS
enum  RPC_NOSUCHFUNCTION
enum  RPC_FORBIDDENFUNCTION
enum  RPC_NOSUCHMETHOD
enum  RPC_FORBIDDENMETHOD

Functions

 mnet_get_hostname_from_uri ($uri=null)
 mnet_get_public_key ($uri, $application=null)
 mnet_set_public_key ($uri, $key=null)
 mnet_sign_message ($message, $privatekey=null)
 mnet_encrypt_message ($message, $remote_certificate)
 mnet_get_keypair ()
 mnet_generate_keypair ($dn=null, $days=28)
 mnet_update_sso_access_control ($username, $mnet_host_id, $accessctrl)
 mnet_get_peer_host ($mnethostid)
 mnet_sso_apply_indirection ($jumpurl, $url)
 mnet_get_app_jumppath ($applicationid)
 mnet_debug ($debugdata, $debuglevel=1)
 mnet_profile_field_options ()
 mnet_get_hosts ($withdeleted=false)
 mnet_get_service_info (mnet_peer $mnet_peer, $fulldata=true)
 mnet_fields_to_send (mnet_peer $peer)
 mnet_fields_to_import (mnet_peer $peer)
 _mnet_field_helper (mnet_peer $peer, $key)
 mnet_strip_user ($user, $fields)

Enumeration Type Documentation

Definition at line 20 of file lib.php.

Definition at line 22 of file lib.php.

Definition at line 18 of file lib.php.

Definition at line 17 of file lib.php.

Definition at line 19 of file lib.php.

Definition at line 21 of file lib.php.

enum RPC_OK

CONSTANTS ///////////////////////////////////////////////////////////.

Definition at line 16 of file lib.php.


Function Documentation

_mnet_field_helper ( mnet_peer peer,
key 
)

helper for {

See also:
mnet_fields_to_import} and {}

private

Parameters:
mnet_peer$peerthe peer object
string$key'import' or 'export'
Returns:
array (like 'username', 'firstname', etc)

Definition at line 853 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

mnet_debug ( debugdata,
debuglevel = 1 
)

Output debug information about mnet. this will go to the error_log.

Parameters:
mixed$debugdatathis can be a string, or array or object.
int$debugleveloptional , defaults to 1. bump up for very noisy debug info

Definition at line 537 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
string$messageThe data you want to sign
string$remote_certificatePeer's certificate in PEM format
Returns:
string An XML-ENC document

Definition at line 253 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

return an array of the profile fields to import from the given host, when creating/updating user accounts

Parameters:
mnet_peer$peerthe peer we're getting the information from
Returns:
array (like 'username', 'firstname', etc)

Definition at line 839 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

return an array of the profile fields to send with user information to the given mnet host.

Parameters:
mnet_peer$peerthe peer to send the information to
Returns:
array (like 'username', 'firstname', etc)

Definition at line 827 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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).

Parameters:
array$dnThe distinguished name of the server
Returns:
string The signature over that text

Definition at line 339 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

mnet_get_app_jumppath ( applicationid)

Definition at line 520 of file lib.php.

Here is the caller graph for this function:

mnet_get_hostname_from_uri ( uri = null)

Strip extraneous detail from a URL or URI and return the hostname

Parameters:
string$uriThe URI of a file on the remote computer, optionally including its http:// prefix like http://www.example.com/index.html
Returns:
string Just the hostname

Definition at line 32 of file lib.php.

Here is the caller graph for this function:

mnet_get_hosts ( withdeleted = false)

Returns information about MNet peers

Parameters:
bool$withdeletedshould the deleted peers be returned too
Returns:
array

Definition at line 653 of file lib.php.

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

Parameters:
string$stringThe text you want to sign
Returns:
string The signature over that text

Definition at line 312 of file lib.php.

Here is the call graph for this function:

mnet_get_peer_host ( mnethostid)

Definition at line 460 of file lib.php.

Here is the caller graph for this function:

mnet_get_public_key ( uri,
application = null 
)

Get the remote machine's SSL Cert

Parameters:
string$uriThe URI of a file on the remote computer, including its http:// or https:// prefix
Returns:
string A PEM formatted SSL Certificate.

Definition at line 45 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
mnet_peer$mnet_peerthe peer to get information abut
boolean$fulldatawhether to just return which services are published/subscribed, or more information (defaults to full)
Returns:
array If $fulldata is false, an array is returned like: publish => array( serviceid => boolean, serviceid => boolean, ), subscribe => array( serviceid => boolean, serviceid => boolean, ) If $fulldata is true, an array is returned like: servicename => array( apiversion => array( name => string offer => boolean apiversion => int plugintype => string pluginname => string hostsubscribes => boolean hostpublishes => boolean ), )

Definition at line 702 of file lib.php.

Here is the caller graph for this function:

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

Returns:
array(forced => array, optional => array)

Definition at line 575 of file lib.php.

Here is the caller graph for this function:

mnet_set_public_key ( uri,
key = null 
)

Store a URI's public key in a static variable, or retrieve the key for a URI

Parameters:
string$uriThe URI of a file on the remote computer, including its https:// prefix
mixed$keyA 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.
Returns:
mixed A public key OR true/false.

Definition at line 153 of file lib.php.

Here is the caller graph for this function:

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

Parameters:
string$messageThe data you want to sign
resource$privatekeyThe private key to sign the response with
Returns:
string An XML-DSig document

Definition at line 189 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
string$jumpurlthe 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$urlarray with 2 elements 0 - context the url was taken from, possibly just the url, possibly href="url" 1 - the destination url
Returns:
string the url the remote user should be supplied with.

Definition at line 489 of file lib.php.

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.

Parameters:
mixed$userarray or object representing a database record
array$fieldsan array of allowed fields (usually from mnet_fields_to_{send,import}
Returns:
mixed array or object, depending what type of $user object was passed (datatype is respected)

Definition at line 877 of file lib.php.

Here is the caller graph for this function:

mnet_update_sso_access_control ( username,
mnet_host_id,
accessctrl 
)

Definition at line 438 of file lib.php.

Here is the call graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations