Class SloodleSession

Description

The primary API class, which manages all other parts.

Located in /sloodle/lib/sloodle_session.php (line 32)


	
			
Variable Summary
Method Summary
 SloodleSession SloodleSession ([bool $process = true])
 bool authenticate_request ([bool $require = true])
 bool load_module (string $type, bool $db, [bool $require = true], [bool $override_access = false])
 bool validate_user ([bool $require = true], [bool $suppress_autoreg = false], [bool $suppress_autoenrol = false])
Variables
SloodleCourse $course = null (line 62)

The Sloodle course structure for the course this session is accessing

  • access: public
SloodleModule $module = null (line 70)

The Sloodle module this session relates to, if any.

Note: this may be the base Sloodle module class, or a derivative.

  • access: public
SloodleRequest $request = null (line 41)

Incoming HTTP request.

  • access: public
SloodleResponse $response = null (line 48)

Outgoing response - can be rendered to HTTP or as a string.

  • access: public
SloodleUser $user = null (line 55)

Current user information.

  • access: public
Methods
Constructor SloodleSession (line 79)

Constructor - initialises members

SloodleSession SloodleSession ([bool $process = true])
  • bool $process: If true (default) then basic request data will be processed immediately. Otherwise, it can be done manually by calling $request->process_request_data()
authenticate_request (line 132)

Verifies security for the incoming request (but does not check user access).

Initially ensures that the request is coming in on a valid and enabled course/controller (rejects it if not). The password is then checked, and it can handle prim-passwords and object-specific passwords.

  • return: true if successful in authenticating the request, or false if not.
bool authenticate_request ([bool $require = true])
  • bool $require: If true, the function will NOT return on authentication failure. Rather, it will terminate the script with an error message.
load_module (line 101)

Constructs and loads the appropriate module part of the session.

Note that this function will fail if the current VLE user (in the $user member) does not have permission to access it.

  • return: True if successful, or false otherwise. (Note, if parameter $require was true, then the script will terminate before this function returns if something goes wrong)
bool load_module (string $type, bool $db, [bool $require = true], [bool $override_access = false])
  • string $type: The expected type of module - function fails if type is not correctly matched
  • bool $db: If true then the system will also try to load appropriate data from the database, as specified in the module ID request parameter
  • bool $require: If true, then if something goes wrong, the script will be terminated with an error message
  • bool $override_access: If true, then the user access permissions will be overriden to force access (not implemented yet)
validate_user (line 254)

Validates the user account and enrolment (ensures there is an avatar linked to a VLE account, and that the VLE account is enrolled in the current course).

Attempts auto-registration/enrolment if that is allowed and required, and logs-in the user. Server access level is checked if it is specified in the request parameters. Note: if the request indicates that it relates to an object, then the validation fails.

  • return: Returns true if validation and/or autoregistration were successful. Returns false on failure (unless $require was true).
bool validate_user ([bool $require = true], [bool $suppress_autoreg = false], [bool $suppress_autoenrol = false])
  • bool $require: If true, the script will be terminated with an error message if validation fails
  • bool $suppress_autoreg: If true, auto-registration will be completely suppressed for this function call
  • bool $suppress_autoenrol: If true, auto-enrolment will be completely suppressed for this function call

Documentation generated on Mon, 16 Jun 2008 15:57:00 +0100 by phpDocumentor 1.4.0