Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update auth plugins; allow them to not require login if it is not nec…
…essary; add Moodle prototype; default to Guest and no login is required git-svn-id: https://xerteonlinetoolkits.googlecode.com/svn/trunk@317 912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
- Loading branch information
Dave Goodwin
committed
Apr 29, 2012
1 parent
04313cf
commit 0907e1e
Showing
8 changed files
with
421 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
/** | ||
* Always returns true; ideal for demonstration so someone can just click the 'login' button. | ||
* | ||
*/ | ||
class Xerte_Authentication_Moodle extends Xerte_Authentication_Abstract | ||
{ | ||
/* @var $_record array - contains the current user's details - expects keys like firstname, surname */ | ||
|
||
private $_record = null; | ||
|
||
public function getUsername() | ||
{ | ||
return $this->_record->username; | ||
} | ||
|
||
public function getFirstname() | ||
{ | ||
return $this->_record->firstname; | ||
} | ||
|
||
public function getSurname() | ||
{ | ||
return $this->_record->lastname; | ||
} | ||
|
||
public function check() | ||
{ | ||
if (!isset($_SESSION['integrate_with_moodle'])) { | ||
$this->addError("Moodle integration not enabled"); | ||
} | ||
} | ||
|
||
/** Moodle integration should result in us having some funky stuff enabled magically ... */ | ||
public function needsLogin() | ||
{ | ||
global $USER; | ||
if (empty($USER)) { | ||
return true; | ||
} | ||
$this->_record = $USER; | ||
require_login(); /// moodle function - should shunt the user over to a login page for Moodle if it's needed. Hopefully there are no scope issues from calling it here in a function. | ||
return false; | ||
} | ||
|
||
public function login($username, $password) | ||
{ | ||
return true; | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters