• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CWebUser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: kannLoeschen

 /**
  * @param CWebUser $c
  * @return bool
  */
 public function kannLoeschen($c)
 {
     if ($this->getVeranstaltung()->isAdminCurUser()) {
         return true;
     }
     if (!is_null($this->verfasserIn->auth) && $c->getId() == $this->verfasserIn->auth) {
         return true;
     }
     return false;
 }
开发者ID:andi98,项目名称:antragsgruen,代码行数:14,代码来源:IKommentar.php


示例2: local_generateHeader

function local_generateHeader($data)
{
    // only needed for zbx_construct_menu
    global $page;
    header('Content-Type: text/html; charset=UTF-8');
    // construct menu
    $main_menu = [];
    $sub_menus = [];
    zbx_construct_menu($main_menu, $sub_menus, $page, $data['controller']['action']);
    $pageHeader = new CView('layout.htmlpage.header', ['javascript' => ['files' => $data['javascript']['files']], 'page' => ['title' => $data['page']['title']], 'user' => ['lang' => CWebUser::$data['lang'], 'theme' => CWebUser::$data['theme']]]);
    echo $pageHeader->getOutput();
    if ($data['fullscreen'] == 0) {
        global $ZBX_SERVER_NAME;
        $pageMenu = new CView('layout.htmlpage.menu', ['server_name' => isset($ZBX_SERVER_NAME) ? $ZBX_SERVER_NAME : '', 'menu' => ['main_menu' => $main_menu, 'sub_menus' => $sub_menus, 'selected' => $page['menu']], 'user' => ['is_guest' => CWebUser::isGuest(), 'alias' => CWebUser::$data['alias'], 'name' => CWebUser::$data['name'], 'surname' => CWebUser::$data['surname']]]);
        echo $pageMenu->getOutput();
    }
    echo '<div class="' . ZBX_STYLE_ARTICLE . '">';
    // should be replaced with addPostJS() at some point
    zbx_add_post_js('initMessages({});');
    // if a user logs in after several unsuccessful attempts, display a warning
    if ($failedAttempts = CProfile::get('web.login.attempt.failed', 0)) {
        $attempt_ip = CProfile::get('web.login.attempt.ip', '');
        $attempt_date = CProfile::get('web.login.attempt.clock', 0);
        $error_msg = _n('%4$s failed login attempt logged. Last failed attempt was from %1$s on %2$s at %3$s.', '%4$s failed login attempts logged. Last failed attempt was from %1$s on %2$s at %3$s.', $attempt_ip, zbx_date2str(DATE_FORMAT, $attempt_date), zbx_date2str(TIME_FORMAT, $attempt_date), $failedAttempts);
        error($error_msg);
        CProfile::update('web.login.attempt.failed', 0, PROFILE_TYPE_INT);
    }
    show_messages();
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:29,代码来源:layout.htmlpage.php


示例3: checkSelementPermissions

 /**
  * Checks that the user has write permissions to objects used in the map elements.
  *
  * @throws APIException if the user has no permissions to at least one of the objects
  *
  * @param array $selements
  */
 protected function checkSelementPermissions(array $selements)
 {
     if (CWebUser::getType() == USER_TYPE_SUPER_ADMIN) {
         return;
     }
     $hostIds = $groupIds = $triggerIds = $mapIds = array();
     foreach ($selements as $selement) {
         switch ($selement['elementtype']) {
             case SYSMAP_ELEMENT_TYPE_HOST:
                 $hostIds[$selement['elementid']] = $selement['elementid'];
                 break;
             case SYSMAP_ELEMENT_TYPE_HOST_GROUP:
                 $groupIds[$selement['elementid']] = $selement['elementid'];
                 break;
             case SYSMAP_ELEMENT_TYPE_TRIGGER:
                 $triggerIds[$selement['elementid']] = $selement['elementid'];
                 break;
             case SYSMAP_ELEMENT_TYPE_MAP:
                 $mapIds[$selement['elementid']] = $selement['elementid'];
                 break;
         }
     }
     if ($hostIds && !API::Host()->isWritable($hostIds) || $groupIds && !API::HostGroup()->isWritable($groupIds) || $triggerIds && !API::Trigger()->isWritable($triggerIds) || $mapIds && !API::Map()->isWritable($mapIds)) {
         self::exception(ZBX_API_ERROR_PERMISSIONS, _('No permissions to referred object or it does not exist!'));
     }
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:33,代码来源:CMapElement.php


示例4: bodyToString

 function bodyToString($destroy = true)
 {
     $setup_left = (new CDiv([(new CDiv())->addClass(ZBX_STYLE_SIGNIN_LOGO), $this->getList()]))->addClass(ZBX_STYLE_SETUP_LEFT);
     $setup_right = (new CDiv($this->getStage()))->addClass(ZBX_STYLE_SETUP_RIGHT);
     if (CWebUser::$data && CWebUser::getType() == USER_TYPE_SUPER_ADMIN) {
         $cancel_button = (new CSubmit('cancel', _('Cancel')))->addClass(ZBX_STYLE_BTN_ALT)->addClass(ZBX_STYLE_FLOAT_LEFT);
         if ($this->DISABLE_CANCEL_BUTTON) {
             $cancel_button->setEnabled(false);
         }
     } else {
         $cancel_button = null;
     }
     if (array_key_exists($this->getStep() + 1, $this->stage)) {
         $next_button = new CSubmit('next[' . $this->getStep() . ']', _('Next step'));
     } else {
         $next_button = new CSubmit($this->SHOW_RETRY_BUTTON ? 'retry' : 'finish', _('Finish'));
     }
     $back_button = (new CSubmit('back[' . $this->getStep() . ']', _('Back')))->addClass(ZBX_STYLE_BTN_ALT)->addClass(ZBX_STYLE_FLOAT_LEFT);
     if ($this->getStep() == 0 || $this->DISABLE_BACK_BUTTON) {
         $back_button->setEnabled(false);
     }
     $setup_footer = (new CDiv([new CDiv([$next_button, $back_button]), $cancel_button]))->addClass(ZBX_STYLE_SETUP_FOOTER);
     $setup_container = (new CDiv([$setup_left, $setup_right, $setup_footer]))->addClass(ZBX_STYLE_SETUP_CONTAINER);
     return parent::bodyToString($destroy) . $setup_container->ToString();
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:25,代码来源:CSetupWizard.php


示例5: init

 /**
  * Initializes the application component.
  *
  * This method will determine how long user sessions are configured to last, and whether the current request
  * has requested to not extend the current user session, before calling {@link \CWebUser::init()}.
  *
  * @return null
  */
 public function init()
 {
     if (!craft()->isConsole()) {
         // Set the authTimeout based on whether the current identity was created with "Remember Me" checked.
         $data = $this->getIdentityCookieValue();
         $this->authTimeout = craft()->config->getUserSessionDuration($data ? $data[3] : false);
         // Should we skip auto login and cookie renewal?
         $this->_dontExtendSession = !$this->shouldExtendSession();
         $this->autoRenewCookie = !$this->_dontExtendSession;
         parent::init();
     }
 }
开发者ID:kant312,项目名称:sop,代码行数:20,代码来源:UserSessionService.php


示例6: testLoginLogout

 /**
  * @runInSeparateProcess
  * @outputBuffering enabled
  * @dataProvider booleanProvider
  */
 public function testLoginLogout($destroySession)
 {
     $identity = new CUserIdentity('testUser', 'testPassword');
     $user = new CWebUser();
     $user->init();
     // be guest before login
     $this->assertTrue($user->isGuest);
     // do a login
     $this->assertTrue($user->login($identity));
     // don't be guest after login
     $this->assertFalse($user->isGuest);
     $this->assertEquals('testUser', $user->getId());
     $this->assertEquals('testUser', $user->getName());
     $user->logout($destroySession);
     // be guest after logout
     $this->assertNull($user->getId());
     $this->assertEquals($user->guestName, $user->getName());
 }
开发者ID:super-d2,项目名称:codeigniter_demo,代码行数:23,代码来源:CWebUserTest.php


示例7: getReturnUrl

 public function getReturnUrl($defaultUrl = null)
 {
     if ($defaultUrl === null) {
         $defaultUrl = $this->defaultReturnUrl;
     }
     return parent::getReturnUrl($defaultUrl);
 }
开发者ID:rikohz,项目名称:Project1,代码行数:7,代码来源:EWebUser.php


示例8: beforeLogin

 protected function beforeLogin($id, $states, $fromCookie)
 {
     if ($fromCookie) {
         //the cookie isn't here, so we refuse the login
         if (!isset($states[UserIdentity::LOGIN_TOKEN])) {
             return false;
         }
         $model = Users::model()->findByPk($id);
         if ($model == null) {
             return false;
         }
         //check if cookie is correct
         $cookieLoginToken = $states[UserIdentity::LOGIN_TOKEN];
         if (!isset($cookieLoginToken) || $cookieLoginToken != $model->logintoken) {
             return false;
         }
         if (!$model->activated || $model->blocked || $model->deleted) {
             //user deleted
             return false;
         }
     }
     if (!parent::beforeLogin($id, $states, $fromCookie)) {
         return false;
     }
     return true;
 }
开发者ID:jasonhai,项目名称:yii1.1-user-auth-module,代码行数:26,代码来源:authWebUser.php


示例9: checkAccess

	public function checkAccess($operation, $params=array(), $allowCaching=true)
	{
		if(!Yum::hasModule('role') ||	Yum::module('role')->useYiiCheckAccess )
			return parent::checkAccess($operation, $params, $allowCaching);

		return $this->can($operation);	
	}
开发者ID:richardh68,项目名称:yii-user-management,代码行数:7,代码来源:YumWebUser.php


示例10: checkAccess

 public function checkAccess($operation, $params = array(), $allowCaching = true)
 {
     if ($operation === 'admin') {
         return $this->isAdmin();
     }
     return parent::checkAccess($operation, $params, $allowCaching);
 }
开发者ID:qyt1988528,项目名称:union,代码行数:7,代码来源:WebUser.php


示例11: checkAccess

 /**
  * Performs access check for this user.
  * @param string $operation the name of the operation that need access check.
  * @param array $params name-value pairs that would be passed to business rules associated
  * with the tasks and roles assigned to the user.
  * @param boolean $allowCaching whether to allow caching the result of access check.
  * @return boolean whether the operations can be performed by this user.
  */
 public function checkAccess($operation, $params = array(), $allowCaching = true)
 {
     if ($this->getIsAdmin()) {
         return true;
     }
     return parent::checkAccess($operation, $params, $allowCaching);
 }
开发者ID:GsHatRed,项目名称:Yiitest,代码行数:15,代码来源:AuthWebUser.php


示例12: __set

 public function __set($attributeName, $value)
 {
     if ($attributeName == 'userModel') {
         $this->userModel = $value;
     } else {
         parent::__set($attributeName, $value);
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:8,代码来源:WebUser.php


示例13: getReturnUrl

 public function getReturnUrl($defaultUrl = '/')
 {
     $returnUrl = parent::getReturnUrl($defaultUrl);
     if ($returnUrl == '/index.php') {
         return '/';
     }
     return $returnUrl;
 }
开发者ID:kot-ezhva,项目名称:ygin,代码行数:8,代码来源:DaWebUser.php


示例14: checkAccess

 public function checkAccess($operation, $params = array(), $allowCaching = true)
 {
     if ($operation == 'administrator') {
         return Permission::model()->hasGlobalPermission('superadmin', 'read');
     } else {
         return parent::checkAccess($operation, $params, $allowCaching);
     }
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:8,代码来源:LSWebUser.php


示例15: isCustomer

 public function isCustomer()
 {
     if ($this->_isCustomer === null) {
         $customer_user_role = Yii::app()->getModule('user')->customerUser['role'];
         $this->_isCustomer = parent::checkAccess($customer_user_role);
     }
     return $this->_isCustomer;
 }
开发者ID:uldisn,项目名称:yii-user,代码行数:8,代码来源:d2RWebUser.php


示例16: afterLogin

 protected function afterLogin($fromCookie)
 {
     parent::afterLogin($fromCookie);
     $this->updateSession();
     $this->updateIdentity();
     $this->recordlogintime();
     $this->recordonline();
 }
开发者ID:zwq,项目名称:unpei,代码行数:8,代码来源:WebUser.php


示例17: login

 /**
  * @param IUserIdentity $identity
  * @param int           $duration
  * @return bool
  */
 public function login($identity, $duration = 0)
 {
     $this->setState("__branchId", $identity->getBranchId());
     $this->setState("__scope", $identity->getScope());
     $this->setState("__roles", $identity->getRoles());
     $this->setState("__userData", $identity->getUserData());
     return parent::login($identity, $duration);
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:13,代码来源:WebUser.php


示例18: init

 public function init()
 {
     parent::init();
     if (!$this->isGuest) {
         /** @var $u User */
         $u = User::model()->findByPk($this->id);
         $this->_profile = $u;
     }
 }
开发者ID:bartaakos,项目名称:yii-shard-poc,代码行数:9,代码来源:MyWebUser.php


示例19: init

 /**
  * @inheritDoc
  */
 public function init()
 {
     parent::init();
     if (!$this->isGuest) {
         // Note that saveAttributes can return false if the account is active twice the same second
         // because no attributes are updated, therefore we cannot throw an exception if save fails.
         $this->loadAccount()->saveAttributes(array('lastActiveAt' => Helper::sqlNow()));
     }
 }
开发者ID:azamath,项目名称:yii-account,代码行数:12,代码来源:WebUser.php


示例20: __call

 public function __call($name, $parameters)
 {
     try {
         return parent::__call($name, $parameters);
     } catch (CException $e) {
         $m = $this->getModel();
         return call_user_func_array(array($m, $name), $parameters);
     }
 }
开发者ID:newga,项目名称:newga,代码行数:9,代码来源:AccessionUser.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CWidget类代码示例发布时间:2022-05-20
下一篇:
PHP CWebModule类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap