Class SloodleSession

Description

The primary API class, which manages all other parts.

Located in /lib/sloodle_session.php (line 34)


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

The Sloodle course structure for the course this session is accessing

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

The Sloodle module this session relates to, if any.

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

  • access: public
SloodlePluginManager $plugins = null (line 79)

A plugin manager to help give access to plugins for various features.

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

Incoming HTTP request.

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

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

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

Current user information.

  • access: public
Methods
Constructor SloodleSession (line 88)

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

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.
authenticate_user_request (line 279)

Verifies security for the incoming user-centric request.

This ensures that the identified object is authorised for user-centric activities with the specified user.

  • return: TRUE if successful, or FALSE on failure (unless parameter $require was TRUE).
bool authenticate_user_request ([bool $require = true])
  • bool $require: If TRUE (default) then the script will terminate with an error message on failure. Otherwise, it will return false on failure.
load_module (line 111)

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 access can be gained to a module on a separate course from the current controller
validate_avatar (line 578)

Validate the avatar specified in the request, to ensure it is registered to a Moodle account.

(Also ensures that avatar details were in fact provided in the request). This is effectively a less strict version of validated_user(), which also checks enrolment and such like. This function will NOT perform auto-registration or auto-enrolment.

bool validate_avatar ([bool $require = true])
  • bool $require: If true, the script will be terminated with an error message if validation fails
validate_user (line 369)

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. If the request indicates that it relates to an object, then the validation fails. Note: if you only require to ensure that an avatar is registered, then use validate_avatar().

  • return: Returns true if validation and/or autoregistration were successful. Returns false on failure (unless $require was true).
  • see: SloodleSession::validate_avatar()
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 Fri, 17 Jul 2009 11:02:30 +0100 by phpDocumentor 1.4.0