mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merged revisions 56719 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.2.2 ........ r56719 | aoneil | 2008-06-23 16:00:25 +1200 (Mon, 23 Jun 2008) | 2 lines FEATURE: Deault permission failure message set can be changed. ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@56914 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5da717ed1d
commit
3af8299b0b
@ -66,6 +66,13 @@ class Security extends Controller {
|
|||||||
*/
|
*/
|
||||||
public static $template_main = 'Page';
|
public static $template_main = 'Page';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default message set used in permission failures.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected static $default_message_set = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get location of word list file
|
* Get location of word list file
|
||||||
*/
|
*/
|
||||||
@ -81,6 +88,15 @@ class Security extends Controller {
|
|||||||
static function set_word_list($wordListFile) {
|
static function set_word_list($wordListFile) {
|
||||||
Security::$wordlist = $wordListFile;
|
Security::$wordlist = $wordListFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the default message set used in permissions failures.
|
||||||
|
*
|
||||||
|
* @param string|array $messageSet
|
||||||
|
*/
|
||||||
|
static function set_default_message_set($messageSet) {
|
||||||
|
self::$default_message_set = $messageSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,21 +126,27 @@ class Security extends Controller {
|
|||||||
static function permissionFailure($controller = null, $messageSet = null) {
|
static function permissionFailure($controller = null, $messageSet = null) {
|
||||||
// Prepare the messageSet provided
|
// Prepare the messageSet provided
|
||||||
if(!$messageSet) {
|
if(!$messageSet) {
|
||||||
$messageSet = array(
|
if(self::$default_message_set) {
|
||||||
'default' => _t(
|
$messageSet = self::$default_message_set;
|
||||||
'Security.NOTEPAGESECURED',
|
} else {
|
||||||
"That page is secured. Enter your credentials below and we will send you right along."
|
$messageSet = array(
|
||||||
),
|
'default' => _t(
|
||||||
'alreadyLoggedIn' => _t(
|
'Security.NOTEPAGESECURED',
|
||||||
'Security.ALREADYLOGGEDIN',
|
"That page is secured. Enter your credentials below and we will send you right along."
|
||||||
"You don't have access to this page. If you have another account that can access that page, you can log in below."
|
),
|
||||||
),
|
'alreadyLoggedIn' => _t(
|
||||||
'logInAgain' => _t(
|
'Security.ALREADYLOGGEDIN',
|
||||||
'Security.LOGGEDOUT',
|
"You don't have access to this page. If you have another account that can access that page, you can log in below."
|
||||||
"You have been logged out. If you would like to log in again, enter your credentials below."
|
),
|
||||||
),
|
'logInAgain' => _t(
|
||||||
);
|
'Security.LOGGEDOUT',
|
||||||
} else if(!is_array($messageSet)) {
|
"You have been logged out. If you would like to log in again, enter your credentials below."
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_array($messageSet)) {
|
||||||
$messageSet = array('default' => $messageSet);
|
$messageSet = array('default' => $messageSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user