mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE: BasicAuth is now disabled by default on test sites
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@61632 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
8b345f0320
commit
a52d99297b
@ -7,12 +7,10 @@
|
|||||||
class BasicAuth extends Object {
|
class BasicAuth extends Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used on test-environments by default,
|
* Site-wide basic auth is disabled by default but can be enabled as needed in _config.php by calling BasicAuth::enable()
|
||||||
* but can be explicitly disabled.
|
|
||||||
*
|
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
static protected $disabled;
|
static protected $enabled = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Require basic authentication. Will request a username and password if none is given.
|
* Require basic authentication. Will request a username and password if none is given.
|
||||||
@ -23,7 +21,7 @@ class BasicAuth extends Object {
|
|||||||
* @return Member $member
|
* @return Member $member
|
||||||
*/
|
*/
|
||||||
static function requireLogin($realm, $permissionCode) {
|
static function requireLogin($realm, $permissionCode) {
|
||||||
if(self::$disabled) return true;
|
if(!self::$enabled) return true;
|
||||||
if(!Security::database_is_ready() || Director::is_cli()) return true;
|
if(!Security::database_is_ready() || Director::is_cli()) return true;
|
||||||
|
|
||||||
|
|
||||||
@ -66,7 +64,10 @@ class BasicAuth extends Object {
|
|||||||
return $member;
|
return $member;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function enable() {
|
||||||
|
self::$enabled = true;
|
||||||
|
}
|
||||||
static function disable() {
|
static function disable() {
|
||||||
self::$disabled = true;
|
self::$enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user