本文整理汇总了PHP中BaseUser类的典型用法代码示例。如果您正苦于以下问题:PHP BaseUser类的具体用法?PHP BaseUser怎么用?PHP BaseUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: createTempUser
protected function createTempUser()
{
$email = uniqid() . '@' . uniqid() . '.com';
$pass = 'test1234';
$user = new \BaseUser();
$user->email = $email;
$user->raw_password = $pass;
$user->save();
return $user;
}
开发者ID:maniolek,项目名称:auth,代码行数:10,代码来源:StandardTest.php
示例2: _checkFlagFlippers
/**
* Queries the Flag and Flipper and redirects the user to a different
* page if he/her doesn't have the required permissions for
* accessing the current page
*
* @access protected
* @return void
*/
protected function _checkFlagFlippers()
{
$controllerName = Zend_Registry::get('controllerName');
$actionName = Zend_Registry::get('actionName');
$user = BaseUser::getSession();
if (Zend_Registry::get('IS_DEVELOPMENT') && $controllerName != 'error') {
$flagModel = new Flag();
$flag = strtolower(CURRENT_MODULE) . '-' . $controllerName;
if (!$flagModel->checkRegistered($flag, App_Inflector::camelCaseToDash($actionName))) {
$params = array('originalController' => $controllerName, 'originalAction' => $actionName);
$this->_forward('flagflippers', 'error', NULL, $params);
return;
}
}
//Check the flag and flippers for ZFDebug
if (!App_FlagFlippers_Manager::isAllowed($user->group->name, 'testing', 'zfdebug')) {
Zend_Controller_Front::getInstance()->unregisterPlugin('ZFDebug_Controller_Plugin_Debug');
}
if (!App_FlagFlippers_Manager::isAllowed($user->group->name, $controllerName, $actionName)) {
if (empty($user->id)) {
// the user is a guest, save the request and redirect him to
// the login page
$session = new Zend_Session_Namespace('FrontendRequest');
$session->request = serialize($this->getRequest());
if (Zend_Controller_Front::getInstance()->getRequest()->getModuleName() == "frontend") {
$this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'user', 'action' => 'login'), 'default', true));
} else {
$this->_redirect('/profile/login/');
}
} else {
$this->_redirect('/error/forbidden/');
}
}
}
开发者ID:omusico,项目名称:logica,代码行数:42,代码来源:Controller.php
示例3: indexAction
/**
* index action, check if the user has connected,
* @author EL GUENNUNI Sohaib [email protected]
* @param <empty>
* @return <empty>
*/
public function indexAction()
{
if (BaseUser::isLogged()) {
$this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'wall', 'action' => 'index'), 'default', true));
} else {
$this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'user', 'action' => 'login'), 'default', true));
}
}
开发者ID:omusico,项目名称:logica,代码行数:14,代码来源:IndexController.php
示例4: testAuthenticateInvalidUser
public function testAuthenticateInvalidUser()
{
$user = \BaseUser::findFirst(array(array('email' => '[email protected]')));
$auth = DI::getDefault()->get('authNoCredential');
$this->assertEmpty($user);
$this->assertNotInstanceOf('\\Vegas\\Security\\Authentication\\GenericUserInterface', $user);
$this->setExpectedException('\\PHPUnit_Framework_Error');
//Argument 1 passed to Vegas\Security\Authentication::authenticate()
//must implement interface Vegas\Security\Authentication\GenericUserInterface, boolean given
$auth->authenticate($user, null);
}
开发者ID:maniolek,项目名称:auth,代码行数:11,代码来源:NoCredentialTest.php
示例5: isAllowed
/**
* Check if a role is allowed for a certain resource
*
* @param string $role
* @param string $resource
* @return boolean
*/
public static function isAllowed($role = NULL, $resource = NULL, $action = NULL)
{
if (empty($role)) {
$user = BaseUser::getSession();
$role = $user->group->name;
}
if (!empty($resource)) {
$resource = strtolower(CURRENT_MODULE) . '-' . $resource;
}
if (!empty($action)) {
$action = App_Inflector::camelCaseToDash($action);
}
return App_FlagFlippers_Manager::_getFromRegistry()->isAllowed($role, $resource, $action);
}
开发者ID:omusico,项目名称:logica,代码行数:21,代码来源:Manager.php
示例6: InitArray
$_SESSION = NULL;
if (isset($user_ossim_tmp)) {
$_SESSION["_user"] = $user_ossim_tmp;
}
if (isset($tmp_signatures)) {
$_SESSION["acid_sig_names"] = $tmp_signatures;
}
if (isset($tmp_sig_refs)) {
$_SESSION["acid_sig_refs"] = $tmp_sig_refs;
}*/
InitArray($_SESSION['back_list'], 1, 3, "");
$_SESSION['back_list_cnt'] = 0;
PushHistory();
// Check role out and redirect if needed -- Kevin
$roleneeded = 10000;
$BUser = new BaseUser();
//if (($Use_Auth_System == 1) && ($BUser->hasRole($roleneeded) == 0))
if ($Use_Auth_System == 1) {
if ($BUser->hasRole($roleneeded) == 0) {
base_header("Location: {$BASE_urlpath}/index.php");
}
}
// Set cookie to use the correct db.
if (isset($_GET['archive'])) {
"no" == $_GET['archive'] ? $value = 0 : ($value = 1);
setcookie('archive', $value);
base_header("Location: {$BASE_urlpath}/base_main.php");
}
function DBLink()
{
// generate the link to select the other database....
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:base_main.php
示例7: isLogged
/**
* Check if the current user is logged
*
* @return void
*/
public static function isLogged()
{
$user = BaseUser::getSession();
return isset($user->id);
}
开发者ID:nic162,项目名称:Zend-Framework-Skeleton,代码行数:10,代码来源:BaseUser.php
示例8: base_header
}
require "base_conf.php";
include "{$BASE_path}/includes/base_include.inc.php";
include_once "{$BASE_path}/base_db_common.php";
include_once "{$BASE_path}/base_common.php";
$errorMsg = "";
$displayError = 0;
$noDisplayMenu = 1;
// Redirect to base_main.php if auth system is off
if ($Use_Auth_System == 0) {
base_header("Location: base_main.php");
}
if (isset($_POST['submit'])) {
$debug_mode = 0;
// wont login with debug_mode
$BASEUSER = new BaseUser();
$user = filterSql($_POST['login']);
$pwd = filterSql($_POST['password']);
if ($BASEUSER->Authenticate($user, $pwd) == 0) {
header("Location: base_main.php");
exit;
}
} else {
$displayError = 1;
$errorMsg = gettext("User does not exist or your password was incorrect!<br>Please try again");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- <?php
echo gettext("Forensics Console " . $BASE_installID) . $BASE_VERSION;
?>
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:index.php
示例9: set_time_limit
include_once "{$BASE_path}/base_common.php";
include_once "{$BASE_path}/base_qry_common.php";
set_time_limit(300);
if (GET('sensor') != "") {
ossim_valid(GET('sensor'), OSS_DIGIT, 'illegal:' . _("sensor"));
}
// Geoip
include "geoip.inc";
$gi = geoip_open("/usr/share/geoip/GeoIP.dat", GEOIP_STANDARD);
//$addr_type = ImportHTTPVar("addr_type", VAR_DIGIT);
$addr_type = 1;
$submit = ImportHTTPVar("submit", VAR_ALPHA | VAR_SPACE, array(gettext("Delete Selected"), gettext("Delete ALL on Screen"), _ENTIREQUERY));
$dst_ip = NULL;
// Check role out and redirect if needed -- Kevin
$roleneeded = 10000;
$BUser = new BaseUser();
if ($BUser->hasRole($roleneeded) == 0 && $Use_Auth_System == 1) {
base_header("Location: " . $BASE_urlpath . "/index.php");
}
$et = new EventTiming($debug_time_mode);
// The below three lines were moved from line 87 because of the odd errors some users were having
/* Connect to the Alert database */
$db = NewBASEDBConnection($DBlib_path, $DBtype);
$db->baseDBConnect($db_connect_method, $alert_dbname, $alert_host, $alert_port, $alert_user, $alert_password);
$cs = new CriteriaState("base_stat_country.php", "&addr_type=1");
$cs->ReadState();
/* Dump some debugging information on the shared state */
if ($debug_mode > 0) {
PrintCriteriaState();
}
$qs = new QueryState();
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:base_stat_country.php
示例10: save
public function save(Doctrine_Connection $con = null)
{
// a new record?
if (!$this->getId()) {
$this->setUid(UserTable::getMaxUid() + 1);
}
if (!$this->getDomainnameId()) {
// get the default domainname
$domainname = DomainnameTable::getDefaultDomainname();
$this->setDomainnameId($domainname->getId());
}
if (!$this->getLogin()) {
$this->generateLogin();
}
if (!$this->getEmailLocalPart()) {
$this->generateEmailLocalPart();
}
if (!$this->getCryptPassword()) {
$password = new Password();
$this->setPasswordObject($password);
$this->generated_password = $password->getPassword();
}
// linking a one-on-one sfGuardUser
$sfguard_user = $this->getSfGuardUser();
$sfguard_user->setUsername($this->getLogin());
$sfguard_user->setIsActive(true);
$sfguard_user->save();
$this->setSfguarduserId($sfguard_user->getId());
return parent::save();
}
开发者ID:rgevaert,项目名称:uas,代码行数:30,代码来源:User.class.php
示例11: save
/**
* Adds a forum assigned to the user when it is created
*
* @return bool
*/
public function save(PropelPDO $con = null)
{
//Check if it's a new user before saving
$new = $this->isNew();
$this->setLastActivityAt(time());
//Save and return false on an error
if (!parent::save($con)) {
return false;
}
//If it was new...
if ($new) {
//Create a forum for it
$forum = new Forum();
$forum->setName($this->getName());
$forum->setType(Forum::TYPE_USER_FORUM);
$forum->setEntityId($this->getId());
//If the forum didn't work
if (!$forum->save()) {
//Delete the group and return false
$this->delete();
return false;
}
}
return true;
}
开发者ID:rayku,项目名称:rayku,代码行数:30,代码来源:User.php
示例12: init
public function init()
{
parent::init();
if (!$this->getOption('include_password')) {
$this->remove('passwd')->remove('passwd-confirm')->remove('show-password');
}
}
开发者ID:uthando-cms,项目名称:uthando-user,代码行数:7,代码来源:User.php
示例13: __construct
public function __construct()
{
parent::__construct();
$this->roles = array('ROLE_USER');
$this->accepteCGU = true;
$this->possession = new arrayCollection();
$this->profilComplet = 0;
}
开发者ID:hmel50100,项目名称:Manblio,代码行数:8,代码来源:User.php
示例14: getName
function getName()
{
$name = parent::getName();
if ($name == " " || $name == null) {
return parent::getNetid();
}
return $name;
}
开发者ID:nhallpot,项目名称:CSCrew2015-back,代码行数:8,代码来源:User.php
示例15: foreach
function __construct($Array)
{
parent::__construct($Array);
foreach ($this->EducationInfo as $Key => $Value) {
if (isset($Array[$Key])) {
$this->EducationInfo[$Key] = $Array[$Key];
}
}
}
开发者ID:pranphy,项目名称:Blog,代码行数:9,代码来源:User.Class.php
示例16:
function __construct($username, $password, $user_id, $ip = '', $last_login = 0)
{
parent::__construct($username, $password, $user_id, $ip, $last_login);
self::$db = MySQL_Database::instance();
$this->username = $username;
$this->password = $password;
$this->user_id = (int) $user_id;
$this->ip = $ip;
$this->last_login = $last_login;
}
开发者ID:ralf-strehle,项目名称:AjaxIM,代码行数:10,代码来源:MySQL.php
示例17: delete
public function delete($con = null)
{
try {
$con = Propel::getConnection();
$con->begin();
//deletes generic document
$genericDocument = Document::getGenericDocument($this);
$genericDocument->delete();
parent::delete();
$con->commit();
Document::deleteObjCache($this);
return true;
} catch (Exception $e) {
$con->rollback();
throw $e;
}
}
开发者ID:kotow,项目名称:work,代码行数:17,代码来源:User.php
示例18: setPassword
/**
* Sets the user password.
*
* @param string $password
*/
public function setPassword($password)
{
if (!$password && 0 == strlen($password)) {
return;
}
if (!($salt = $this->getSalt())) {
$salt = sha1(uniqid(mt_rand(), true));
$this->setSalt($salt);
}
$modified = $this->getModified();
$algorithm = sfConfig::get('app_doAuth_algorithm_callable', 'sha1');
$algorithmAsStr = is_array($algorithm) ? $algorithm[0] . '::' . $algorithm[1] : $algorithm;
if (!is_callable($algorithm)) {
throw new sfException(sprintf('The algorithm callable "%s" is not callable.', $algorithmAsStr));
}
parent::_set('password', call_user_func_array($algorithm, array($salt . $password)));
}
开发者ID:sergiovier,项目名称:doAuthPlugin,代码行数:22,代码来源:PluginUser.class.php
示例19: save
public function save($connection = null)
{
parent::save($connection);
foreach ($this->aclUserGroups as $aclUserGroup) {
$aclUserGroup->user = $this;
try {
$aclUserGroup->save();
} catch (PropelException $e) {
}
}
foreach ($this->aclPermissions as $aclPermission) {
$aclPermission->user = $this;
try {
$aclPermission->save();
} catch (PropelException $e) {
}
}
return $this;
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:19,代码来源:QubitUser.php
示例20: save
public function save(PropelPDO $con = null)
{
if (!$this->getId()) {
$this->setUid(UserPeer::getMaxUid() + 1);
$password = new Password();
$this->generated_password = $password->getPassword();
$this->setNtPassword($password->getNtHash());
$this->setUnixPassword($password->getNtHash());
$this->setCryptPassword($password->getCryptHash());
$this->setLmPassword($password->getLmHash());
}
if (!$this->getDomainnameId()) {
// get the default domainname
$domainname = DomainnamePeer::getDefaultDomainname();
$this->setDomainnameId($domainname->getId());
}
if (!$this->getLogin()) {
$this->generateLogin();
}
if (!$this->getEmailLocalPart()) {
$this->generateEmailLocalPart();
}
return parent::save();
}
开发者ID:habtom,项目名称:uas,代码行数:24,代码来源:User.php
注:本文中的BaseUser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论