本文整理汇总了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;
}
示例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/');
}
}
}
示例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));
}
}
示例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);
}
示例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);
}
示例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....
示例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();
}
示例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;
}
示例9: init
public function init()
{
parent::init();
if (!$this->getOption('include_password')) {
$this->remove('passwd')->remove('passwd-confirm')->remove('show-password');
}
}
示例10: __construct
public function __construct()
{
parent::__construct();
$this->roles = array('ROLE_USER');
$this->accepteCGU = true;
$this->possession = new arrayCollection();
$this->profilComplet = 0;
}
示例11: getName
function getName()
{
$name = parent::getName();
if ($name == " " || $name == null) {
return parent::getNetid();
}
return $name;
}
示例12: foreach
function __construct($Array)
{
parent::__construct($Array);
foreach ($this->EducationInfo as $Key => $Value) {
if (isset($Array[$Key])) {
$this->EducationInfo[$Key] = $Array[$Key];
}
}
}
示例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;
}
示例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;
}
}
示例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)));
}