/**
	 * Since DataObjectRetroactiveCleanerTask can be destructive,
	 * make sure that only admins can run it.
	 */
	public function testAccessRestrictionWithNonAdminMember() {
		$devServers = Object::combined_static('Director', 'dev_servers');
		Director::set_dev_servers(array('example.com'));
		$response = $this->get("dev/tasks/DataObjectRetroactiveCleanerTask");
		
		$selector = 'form[action="Security/LoginForm"]';
		$this->assertTrue((bool)$this->cssParser()->getBySelector($selector),
			'Non admin members can run DataObjectRetroactiveCleanerTask.');
		
		Director::set_dev_servers($devServers);
	}
예제 #2
0
<?php

global $project;
$project = 'mysite';

global $databaseConfig;
$databaseConfig = array(
	"type" => "MySQLDatabase",
	"server" => "localhost", 
	"username" => "root", 
	"password" => "", 
	"database" => "SS_mysite",
);

// Sites running on the following servers will be
// run in development mode. See
// http://doc.silverstripe.com/doku.php?id=devmode
// for a description of what dev mode does.
Director::set_dev_servers(array(
	'localhost',
	'127.0.0.1',
));

// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.com/themes/
SSViewer::set_theme('mysite');

Security::setDefaultAdmin('admin', 'password');

?>
<?php

global $project;
$project = 'mysite';
// Get the DB connection details
require_once 'dbconn.php';
// Database config
global $databaseConfig;
// Set the database connection details
$databaseConfig = array("type" => 'MySQLDatabase', "server" => $server, "username" => $username, "password" => $password, "database" => $database, "path" => '');
// Sites running on the following servers will be
// run in development mode. See
// http://doc.silverstripe.org/doku.php?id=configuration
// for a description of what dev mode does.
Director::set_dev_servers(array('lyc.local', '127.0.0.1'));
Email::setAdminEmail('*****@*****.**');
//Director::set_environment_type("dev");
//UploadifyField::show_debug();
//Security::setDefaultAdmin('*****@*****.**', 't627t');
Security::setDefaultAdmin('loveyourcoast', 'loveyour12345');
MySQLDatabase::set_connection_charset('utf8');
// Set the site locale
i18n::set_locale('en_NZ');
// enable nested URLs for this site (e.g. page/sub-page/)
SiteTree::enable_nested_urls();
//Add the CleanUpRole
//this extends the membership class and gives the
//relationships between member and cleanup
DataObject::add_extension('Member', 'CleanUpRole');
//FB
//FacebookConnect::set_api_key('3c7656ec45da9e30dbac9fca551b9753');
<?php

global $project;
$project = 'mysite';
include_once dirname(__FILE__) . '/local.conf.php';
// Sites running on the following servers will be
// run in development mode. See
// http://doc.silverstripe.com/doku.php?id=devmode
// for a description of what dev mode does.
Director::set_dev_servers(array('127.0.0.1'));
if (!defined('SS_LOG_FILE')) {
    define('SS_LOG_FILE', '/var/log/silverstripe/' . basename(dirname(dirname(__FILE__))) . '.log');
}
SS_Log::add_writer(new SS_LogFileWriter(SS_LOG_FILE), SS_Log::NOTICE, '<=');
// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.com/themes/
SSViewer::set_theme('dew');
// enable nested URLs for this site (e.g. page/sub-page/)
SiteTree::enable_nested_urls();
MySQLDatabase::set_connection_charset('utf8');
// necessary for now
SQLite3Database::$vacuum = false;
// Sets up relevant cache settings to prevent permission errors
SS_Cache::add_backend('default', 'File', array('cache_dir' => TEMP_FOLDER . DIRECTORY_SEPARATOR . 'cache', 'hashed_directory_umask' => 2775, 'cache_file_umask' => 0660));
require_once 'Zend/Cache.php';
require_once 'Zend/Date.php';
$coreCache = Zend_Cache::factory('Core', 'File', array(), array('hashed_directory_umask' => 2775, 'cache_file_umask' => 0660, 'cache_dir' => TEMP_FOLDER));
Zend_Date::setOptions(array('cache' => $coreCache));