mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merged revisions 48361-48363 via svnmerge from
svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq ........ r48361 | ischommer | 2008-01-21 21:05:53 +1300 (Mon, 21 Jan 2008) | 1 line documentation ........ r48362 | ischommer | 2008-01-21 21:07:13 +1300 (Mon, 21 Jan 2008) | 1 line documentation ........ r48363 | ischommer | 2008-01-21 21:07:43 +1300 (Mon, 21 Jan 2008) | 1 line documentation ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@52405 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
051e1bc68b
commit
7ae4a30885
@ -358,6 +358,8 @@ class Controller extends ViewableData {
|
||||
|
||||
/**
|
||||
* Initialisation function that is run before any action on the controller is called.
|
||||
*
|
||||
* @uses BasicAuth::requireLogin()
|
||||
*/
|
||||
function init() {
|
||||
// Test and development sites should be secured, via basic-auth
|
||||
|
@ -11,9 +11,22 @@
|
||||
* @subpackage security
|
||||
*/
|
||||
class BasicAuth extends Object {
|
||||
|
||||
/**
|
||||
* Used on test-environments by default,
|
||||
* but can be explicitly disabled.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
static protected $disabled;
|
||||
|
||||
/**
|
||||
* Require basic authentication. Will request a username and password if none is given.
|
||||
* @param memberValidationFunction A boolean method to call on the member to validate them.
|
||||
*
|
||||
* @usedby Controller::init()
|
||||
* @param string $realm
|
||||
* @param string|array $permissionCode
|
||||
* @return Member $member
|
||||
*/
|
||||
static function requireLogin($realm, $permissionCode) {
|
||||
if(self::$disabled) return true;
|
||||
@ -59,7 +72,6 @@ class BasicAuth extends Object {
|
||||
return $member;
|
||||
}
|
||||
|
||||
static protected $disabled;
|
||||
static function disable() {
|
||||
self::$disabled = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user