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


PHP User::isUserAdmin方法代码示例

本文整理汇总了PHP中common\models\User::isUserAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP User::isUserAdmin方法的具体用法?PHP User::isUserAdmin怎么用?PHP User::isUserAdmin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common\models\User的用法示例。


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

示例1: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'only' => ['index', 'delete'], 'rules' => [['allow' => true, 'actions' => ['index', 'delete'], 'roles' => ['@'], 'matchCallback' => function () {
         //Llamada al método que comprueba si es un vendedor
         return \common\models\User::isUserAdmin(Yii::$app->user->identity->id);
     }]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['POST']]]];
 }
开发者ID:rvences,项目名称:mopoua,代码行数:10,代码来源:TipoingresoegresoController.php

示例2: loginAdmin

 public function loginAdmin()
 {
     if ($this->validate() && User::isUserAdmin($this->username)) {
         return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
     } else {
         return false;
     }
 }
开发者ID:avkosme,项目名称:test,代码行数:8,代码来源:LoginForm.php

示例3: loginAdmin

 public function loginAdmin()
 {
     if ($this->validate() && User::isUserAdmin($this->username)) {
         return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
     } else {
         $this->addError('password', 'Incorrect username or password.');
         return false;
     }
 }
开发者ID:BorisMatonickin,项目名称:yiicms,代码行数:9,代码来源:LoginForm.php

示例4: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'rules' => [['actions' => ['error'], 'allow' => true, 'matchCallback' => function ($rule, $action) {
         if (!User::isUserAdmin(Yii::$app->user->identity->username)) {
             return $this->redirect(['../']);
         } else {
             return true;
         }
     }], ['actions' => ['logout'], 'allow' => true, 'roles' => ['@']], ['actions' => ['login', 'index'], 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         if (!User::isUserAdmin(Yii::$app->user->identity->username)) {
             return $this->redirect(['../']);
         } else {
             return true;
         }
     }]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['logout' => ['post']]]];
 }
开发者ID:BeerMan88,项目名称:yii,代码行数:19,代码来源:SiteController.php

示例5: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['POST']]], 'access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         return User::isUserAdmin(Yii::$app->user->identity->username);
     }]]]];
 }
开发者ID:kusma007,项目名称:one-advanced,代码行数:9,代码来源:AnswersController.php

示例6: behaviors

 /**
  * Restrict access permissions to admin user and users with auth-item 'module-controller'
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'rules' => [['actions' => ['index', 'view', 'create', 'update', 'delete', 'recalculate'], 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         return User::isUserAdmin(Yii::$app->user->identity->username);
     }]]]];
 }
开发者ID:RubenDjOn,项目名称:originofthememes,代码行数:10,代码来源:AuthorController.php

示例7: isset

echo Html::encode($this->title);
?>
</title>
    <?php 
$this->head();
?>
</head>
<body>
    <?php 
$this->beginBody();
?>
    <div class="wrap">
        <?php 
NavBar::begin(['brandLabel' => 'Origin of the Memes', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$menuItems = [];
if (!Yii::$app->user->isGuest && User::isUserAdmin(Yii::$app->user->identity->username)) {
    $menuItems = [['label' => 'Vidmage', 'items' => [['label' => 'Vidmage List', 'url' => ['/vidmage/index']], ['label' => 'Vidmage New', 'url' => ['/vidmage/create']], ['label' => 'Category', 'url' => ['/category/index']], ['label' => 'Author', 'url' => ['/author/index']], ['label' => 'Tag', 'url' => ['/tag/index']]]], ['label' => 'Meme', 'url' => ['/meme/index']], ['label' => 'Platform', 'url' => ['/platform/index']]];
}
if (Yii::$app->user->isGuest) {
    $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
} else {
    $menuItems[] = ['label' => 'Logout (' . Yii::$app->user->identity->username . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']];
}
$menuItems[] = ['label' => 'Frontend', 'url' => Yii::getAlias('@frontendUrl')];
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-left'], 'items' => $menuItems]);
NavBar::end();
?>

        <div class="container">
        <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
开发者ID:RubenDjOn,项目名称:originofthememes,代码行数:31,代码来源:main.php

示例8: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'rules' => [['actions' => ['login', 'error'], 'allow' => true], ['actions' => ['index', 'logout'], 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         return User::isUserAdmin(Yii::$app->user->identity->username);
     }]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['logout' => ['post']]]];
 }
开发者ID:RubenDjOn,项目名称:originofthememes,代码行数:9,代码来源:SiteController.php


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