当前位置: 首页>>代码示例>>PHP>>正文


PHP Security::setDefaultAdmin方法代码示例

本文整理汇总了PHP中Security::setDefaultAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP Security::setDefaultAdmin方法的具体用法?PHP Security::setDefaultAdmin怎么用?PHP Security::setDefaultAdmin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Security的用法示例。


在下文中一共展示了Security::setDefaultAdmin方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCheckDefaultAdmin

 public function testCheckDefaultAdmin()
 {
     if (Security::has_default_admin()) {
         $this->markTestSkipped('Default admin present. There\'s no way to inspect default admin state, ' . 'so we don\'t override existing settings');
     }
     Security::setDefaultAdmin('admin', 'password');
     $this->assertTrue(Security::has_default_admin());
     $this->assertTrue(Security::check_default_admin('admin', 'password'), 'Succeeds with correct username and password');
     $this->assertFalse(Security::check_default_admin('wronguser', 'password'), 'Fails with incorrect username');
     $this->assertFalse(Security::check_default_admin('admin', 'wrongpassword'), 'Fails with incorrect password');
     Security::setDefaultAdmin(null, null);
 }
开发者ID:fanggu,项目名称:loveyourwater_ss_v3.1.6,代码行数:12,代码来源:SecurityDefaultAdminTest.php

示例2: tearDown

 public function tearDown()
 {
     Security::setDefaultAdmin($this->defaultUsername, $this->defaultPassword);
     parent::tearDown();
 }
开发者ID:nickbooties,项目名称:silverstripe-framework,代码行数:5,代码来源:SecurityDefaultAdminTest.php

示例3: array

<?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');

?>
开发者ID:neopba,项目名称:silverstripe-book,代码行数:30,代码来源:_config_example.php

示例4: array

/*
global $databaseConfig;
$databaseConfig = array(
	"type" => 'MySQLDatabase',
	"server" => 'localhost',
	"username" => 'root',
	"password" => 'root',
	"database" => 'FuelDemo2016',
	"path" => '',
);
*/
// ******* LIVE Database Settings ******
global $databaseConfig;
$databaseConfig = array("type" => 'MySQLDatabase', "server" => 'localhost', "username" => 'fuel2', "password" => 'coyote5.!6', "database" => 'fuel2', "path" => '');
// Initial acmin account set-up - can be removed
Security::setDefaultAdmin('neil@fuel.ie', 'apples');
// Sets the CMS logo link to go to the site base URL
LeftAndMain::set_application_link(Director::baseURL());
// Set the site locale
i18n::set_locale('en_GB');
date_default_timezone_set('Europe/London');
//Enable Site Search **
//FulltextSearchable::enable();
Object::add_extension('SiteConfig', 'CustomSiteConfig');
//Force redirect to www.
Director::forceWWW();
//Show errors while in development only (to be removed)
error_reporting(E_ALL);
// Customise TinyMCE options
HtmlEditorConfig::get('cms')->setOption('theme_advanced_blockformats', 'p,h1,h2,h3,h4');
HtmlEditorConfig::get('cms')->setOption('theme_advanced_disable', 'styleselect');
开发者ID:neilcreagh,项目名称:FuelCMS,代码行数:31,代码来源:_config.php

示例5: dirname

if (!isset($database) || !$database) {
    // if SS_DATABASE_CHOOSE_NAME
    if (defined('SS_DATABASE_CHOOSE_NAME') && SS_DATABASE_CHOOSE_NAME) {
        $loopCount = (int) SS_DATABASE_CHOOSE_NAME;
        $databaseDir = dirname($_SERVER['SCRIPT_FILENAME']);
        for ($i = 0; $i < $loopCount; $i++) {
            $databaseDir = dirname($databaseDir);
        }
        $database = "SS_" . basename($databaseDir);
        $database = str_replace('.', '', $database);
    }
}
if (defined('SS_DATABASE_USERNAME') && defined('SS_DATABASE_PASSWORD')) {
    global $databaseConfig;
    $databaseConfig = array("type" => "MySQLDatabase", "server" => defined('SS_DATABASE_SERVER') ? SS_DATABASE_SERVER : 'localhost', "username" => SS_DATABASE_USERNAME, "password" => SS_DATABASE_PASSWORD, "database" => (defined('SS_DATABASE_PREFIX') ? SS_DATABASE_PREFIX : '') . $database . (defined('SS_DATABASE_SUFFIX') ? SS_DATABASE_SUFFIX : ''));
}
if (defined('SS_SEND_ALL_EMAILS_TO')) {
    Email::send_all_emails_to(SS_SEND_ALL_EMAILS_TO);
}
if (defined('SS_DEFAULT_ADMIN_USERNAME')) {
    if (!defined('SS_DEFAULT_ADMIN_PASSWORD')) {
        user_error("SS_DEFAULT_ADMIN_PASSWORD must be defined in your _ss_environment.php, if SS_DEFAULT_ADMIN_USERNAME is defined.  See http://doc.silverstripe.com/doku.php?id=environment-management for more infomration", E_USER_ERROR);
    }
    Security::setDefaultAdmin(SS_DEFAULT_ADMIN_USERNAME, SS_DEFAULT_ADMIN_PASSWORD);
}
if (defined('SS_USE_BASIC_AUTH') && SS_USE_BASIC_AUTH) {
    BasicAuth::protect_entire_site();
}
if (defined('SS_ERROR_LOG')) {
    Debug::log_errors_to(SS_ERROR_LOG);
}
开发者ID:racontemoi,项目名称:shibuichi,代码行数:31,代码来源:ConfigureFromEnv.php

示例6: array

<?php

/*
 * Include any local instance specific configuration here - typically
 * this includes any database settings, email settings, etc that change
 * between installations. 
 */
global $databaseConfig;
$databaseConfig = array("type" => "{${db . type}}", "server" => "{${db . host}}", "username" => "{${db . user}}", "password" => "{${db . pass}}", "database" => "{${db . name}}");
Security::setDefaultAdmin('${admin.username}', '${admin.password}');
// Email::setAdminEmail('admin@example.org');
define('SS_LOG_FILE', dirname(__FILE__) . '/' . basename(dirname(dirname(__FILE__))) . '.log');
开发者ID:rodneyway,项目名称:ss3-misc,代码行数:12,代码来源:local.conf.sample.php

示例7: array

// 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('admin@loveyourcoast.org');
//Director::set_environment_type("dev");
//UploadifyField::show_debug();
//Security::setDefaultAdmin('lydia@toast.co.nz', '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');
//FacebookConnect::set_api_secret('bbde13e55878f786355b1eea84173dde');
//FacebookConnect::set_app_id('104014689670653');
// Sortable
//SortableDataObject::add_sortable_class('TopCleanUp');
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:31,代码来源:_config.php

示例8: array

<?php

global $project;
$project = 'mysite';
global $databaseConfig;
$databaseConfig = array("type" => 'MySQLDatabase', "server" => '127.0.0.1', "username" => 'root', "password" => 'password', "database" => 'ss_official', "path" => '');
// Set the site locale
i18n::set_locale('en_US');
//Security::SetDefaultAdmin('admin', 'admin');
if (Director::isLive()) {
    SS_Log::add_writer(new SS_LogEmailWriter('allen@easymode.com.au'), SS_Log::ERR);
} else {
    //isTest or isDev
    SS_Log::add_writer(new SS_LogFileWriter('../silverstripe-errors-warnings.log'), SS_Log::WARN, '<=');
    SS_Log::add_writer(new SS_LogFileWriter('../silverstripe-errors.log'), SS_Log::ERR);
}
session_save_path('/tmp');
Security::setDefaultAdmin('admin', 'admin');
开发者ID:lili0allen,项目名称:ss_tutorial,代码行数:18,代码来源:_config.php

示例9: reset

<?php

/**
 * User: Julian Scheuchenzuber <js@lvl51.de>
 * Date: 22.10.15
 * Time: 12:12
 */
if (isset($GLOBALS['_DEFAULT_ADMINS'])) {
    // Reset pointer and fetch data of first record
    reset($GLOBALS['_DEFAULT_ADMINS']);
    $email = key($GLOBALS['_DEFAULT_ADMINS']);
    $pw = $GLOBALS['_DEFAULT_ADMINS'][$email];
    // Set default admin if not exists
    if (!Security::has_default_admin()) {
        Security::setDefaultAdmin($email, $pw);
    }
}
开发者ID:helpfulrobot,项目名称:level51-more-admins,代码行数:17,代码来源:_config.php

示例10: tearDown

 public function tearDown()
 {
     Security::setDefaultAdmin($this->defaultUsername, $this->defaultPassword);
     Permission::flush_permission_cache();
     parent::tearDown();
 }
开发者ID:XDdesigners,项目名称:silverstripe-framework,代码行数:6,代码来源:SecurityDefaultAdminTest.php

示例11: loginAsAdmin

 /**
  * Ensures we have permissions to manipulate pages (gets around access issues with global state). Unfortunately, the
  * creation of a default admin account below is necessary because SilverStripe will reference global state via
  * Member::currentUser() and the only surefire way around this is to login as a default admin with full access.
  *
  * CAUTION: Since migrations can only be run from the command line, it's assumed that if you're accessing this, then
  * you're already an admin or you've got an incorrectly configured site!
  *
  * TODO: This should be removed soon.
  *
  * @deprecated  Use ::whileAdmin() instead.
  */
 protected static function loginAsAdmin()
 {
     Deprecation::notice('0', 'Use ::whileAdmin() instead. This method will be removed soon.');
     if (!Member::currentUserID()) {
         // See if a default admin is setup yet.
         if (!Security::has_default_admin()) {
             // Generate a randomized user/pass and use that as the default administrator just for this session.
             $user = substr(str_shuffle(sha1("u" . microtime())), 0, 20);
             $pass = substr(str_shuffle(sha1("p" . microtime())), 0, 20);
             Security::setDefaultAdmin($user, $pass);
         }
         $admin = Member::default_admin();
         if (!$admin) {
             throw new MigrationException("Cannot login: No default administrator found.");
         }
         Session::start();
         Session::set("loggedInAs", $admin->ID);
     }
 }
开发者ID:patricknelson,项目名称:silverstripe-migrations,代码行数:31,代码来源:Migration.php

示例12:

<?php

global $project;
$project = 'mysite';
global $database;
$database = '';
// Set the site locale
i18n::set_locale('en_US');
Security::setDefaultAdmin('page1', 'page1');
开发者ID:saiyan,项目名称:selim,代码行数:9,代码来源:_config.php

示例13: str_replace

<?php

global $project;
$project = 'mysite';
require_once str_replace('//', '/', dirname(__FILE__) . '/') . '../.shi/shi.php';
if (_shi('admin_set') > 0) {
    Security::setDefaultAdmin(_shi('admin_username'), _shi('admin_password'));
}
global $databaseConfig;
$database = _shi('db_name_prefix') . _shi('db_name') . _shi('db_name_suffix');
$databaseConfig = array('type' => 'MySQLDatabase', 'server' => _shi('db_server'), 'username' => _shi('db_username'), 'password' => _shi('db_password'), 'database' => $database);
if (_shi('mode') == 'dev') {
    Director::set_environment_type('dev');
}
// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.com/themes/
SSViewer::set_theme('blackcandy');
开发者ID:racontemoi,项目名称:shibuichi,代码行数:17,代码来源:_config.php

示例14: ini_set

<?php

global $project;
$project = 'cocina';
ini_set('memory_limit', '80M');
ini_set('mysql.connect_timeout', 14400);
date_default_timezone_set('Europe/Madrid');
global $database;
//LOCAL
//$database = 'SS_cocina';
//cocina.COM
//$database = 'db562588325';
//HOMECOOKING
$database = 'db563848102';
require_once 'conf/ConfigureFromEnv.php';
//Item::add_extension('ItemExtension');
Security::setDefaultAdmin("arangeltorres@gmail.com", "gelves08");
Object::useCustomClass("MemberLoginForm", "CocinaLoginForm");
/*Object::add_extension("Group", 'GroupExtension');
Object::add_extension("ChefObject", 'Addressable');
Object::add_extension('ChefObject', 'Geocodable');*/
// Set the site locale
i18n::set_locale('en_GB');
Translatable::set_default_locale('en_GB');
开发者ID:8secs,项目名称:cocina,代码行数:24,代码来源:_config.php


注:本文中的Security::setDefaultAdmin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。