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


PHP BaseUser类代码示例

本文整理汇总了PHP中BaseUser的典型用法代码示例。如果您正苦于以下问题:PHP BaseUser类的具体用法?PHP BaseUser怎么用?PHP BaseUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BaseUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 s.elguennuni@gmail.com
  * @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' => 'fake@email.com')));
     $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: 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

示例8: 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

示例9: 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

示例10: __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

示例11: getName

 function getName()
 {
     $name = parent::getName();
     if ($name == " " || $name == null) {
         return parent::getNetid();
     }
     return $name;
 }
开发者ID:nhallpot,项目名称:CSCrew2015-back,代码行数:8,代码来源:User.php

示例12: 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

示例13:

 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

示例14: 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

示例15: 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


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