當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CWebUser類代碼示例

本文整理匯總了PHP中CWebUser的典型用法代碼示例。如果您正苦於以下問題:PHP CWebUser類的具體用法?PHP CWebUser怎麽用?PHP CWebUser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CWebUser類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: getReturnUrl

 public function getReturnUrl($defaultUrl = null)
 {
     if ($defaultUrl === null) {
         $defaultUrl = $this->defaultReturnUrl;
     }
     return parent::getReturnUrl($defaultUrl);
 }
開發者ID:rikohz,項目名稱:Project1,代碼行數:7,代碼來源:EWebUser.php

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

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

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

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

示例10: __set

 public function __set($attributeName, $value)
 {
     if ($attributeName == 'userModel') {
         $this->userModel = $value;
     } else {
         parent::__set($attributeName, $value);
     }
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:8,代碼來源:WebUser.php

示例11: getReturnUrl

 public function getReturnUrl($defaultUrl = '/')
 {
     $returnUrl = parent::getReturnUrl($defaultUrl);
     if ($returnUrl == '/index.php') {
         return '/';
     }
     return $returnUrl;
 }
開發者ID:kot-ezhva,項目名稱:ygin,代碼行數:8,代碼來源:DaWebUser.php

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

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

示例14: afterLogin

 protected function afterLogin($fromCookie)
 {
     parent::afterLogin($fromCookie);
     $this->updateSession();
     $this->updateIdentity();
     $this->recordlogintime();
     $this->recordonline();
 }
開發者ID:zwq,項目名稱:unpei,代碼行數:8,代碼來源:WebUser.php

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


注:本文中的CWebUser類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。