예제 #1
0
파일: main.php 프로젝트: sunil120/yii2
              <a href="#">
                <i class="fa fa-file"></i> <span>Page Management</span> <i class="fa fa-angle-left pull-right"></i>
              </a>
              <ul class="treeview-menu">
                <?php 
    if (AccessRule::accessRule('page', 'index')) {
        ?>
                <li class="active"><a href="<?php 
        echo Yii::$app->params['adminUrl'];
        ?>
page"><i class="fa fa-circle-o"></i>Manage Pages</a></li>
                <?php 
    }
    ?>
                <?php 
    if (AccessRule::accessRule('page', 'create')) {
        ?>
                <li><a href="<?php 
        echo Yii::$app->params['adminUrl'];
        ?>
page/create"><i class="fa fa-plus"></i>Add Page</a></li>
                <?php 
    }
    ?>
              </ul>
            </li>
            <?php 
}
?>
          </ul>
        </section>
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'ruleConfig' => ['class' => AccessRule::className()], 'only' => ['create', 'update', 'delete', 'index'], 'rules' => [['actions' => ['create'], 'allow' => true, 'roles' => ['@']], ['actions' => ['update'], 'allow' => true, 'roles' => ['@']], ['actions' => ['delete'], 'allow' => true, 'roles' => ['@']], ['actions' => ['index'], 'allow' => true, 'roles' => [User::ROLE_ADMIN, User::ROLE_SUPER]]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]];
 }
예제 #3
0
 public function behaviors()
 {
     return ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]], 'access' => ['class' => AccessControl::className(), 'rules' => [['actions' => AccessRule::userAccess(), 'allow' => true]]]];
 }
예제 #4
0
파일: view.php 프로젝트: sunil120/yii2
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use common\components\AccessRule;
/* @var $this yii\web\View */
/* @var $model common\models\Country */
$this->title = 'View Country-' . $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Countries', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$udpateaccess = AccessRule::accessRule(Yii::$app->controller->id, 'update');
$deleteaccess = AccessRule::accessRule(Yii::$app->controller->id, 'delete');
?>
<div id="Country-view" class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
          Country
          <small>View Country</small>
        </h1>
        <ol class="breadcrumb">
          <li><a href="<?php 
echo Yii::$app->params['adminUrl'];
?>
"><i class="fa fa-dashboard"></i> Home</a></li>
          <li><a href="<?php 
echo Yii::$app->params['adminUrl'];
?>
/<?php 
echo Yii::$app->controller->id;
?>
예제 #5
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'ruleConfig' => ['class' => AccessRule::className()], 'rules' => [['actions' => ['login', 'invite', 'auth', 'authlogin'], 'allow' => true, 'roles' => ['?']], ['actions' => ['user', 'index', 'logout', 'request-password-reset'], 'allow' => true, 'roles' => ['@']]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['logout' => ['post']]]];
 }
예제 #6
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'ruleConfig' => ['class' => AccessRule::className()], 'rules' => [['actions' => ['login'], 'allow' => true, 'roles' => ['?']], ['allow' => true, 'roles' => [User::ROLE_AMDIN]], ['actions' => ['logout'], 'allow' => true, 'roles' => ['@']]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['logout' => ['post']]]];
 }
예제 #7
0
 public function behaviors()
 {
     return ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]], 'access' => ['class' => AccessControl::className(), 'only' => ['index', 'report1', 'report2', 'report3', 'report4', 'report5', 'report6', 'indivreport3', 'subindivreport3'], 'ruleConfig' => ['class' => AccessRule::className()], 'rules' => [['actions' => ['index', 'report1', 'report2', 'report3', 'report4', 'report5', 'report6', 'indivreport3', 'subindivreport3'], 'allow' => true, 'roles' => [User::ROLE_USER, User::ROLE_MODERATOR, User::ROLE_ADMIN]]]]];
 }
예제 #8
0
파일: index.php 프로젝트: sunil120/yii2
                    </div>
                    <div class="box-body">
                        <div id="example1_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
                            <div class="row">
                                <div class="col-sm-12"> 
                                    <?php 
Pjax::begin();
?>
      
                                    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'emptyCell' => '-', 'options' => ['class' => 'table-responsive'], 'tableOptions' => ['class' => 'table  table-bordered table-hover'], 'layout' => '{items}<div class=\'table-footer\'>{summary}{pager}</div>', 'pager' => ['prevPageLabel' => 'First', 'nextPageLabel' => 'Last', 'nextPageLabel' => 'Next', 'prevPageLabel' => 'Prev', 'maxButtonCount' => '2'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'company_id', 'branch_id', 'department_name', 'created_dt', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {view} {delete}', 'header' => 'Action', 'headerOptions' => ['style' => 'min-width:90px'], 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', [Yii::$app->controller->id . '/create', 'id' => $model->id], ['title' => 'Update', 'data-pjax' => '0', 'class' => AccessRule::accessRule(Yii::$app->controller->id, 'update') == false ? 'hide' : '']);
}, 'view' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', [Yii::$app->controller->id . '/view', 'id' => $model->id], ['title' => 'View', 'data-pjax' => '0', 'class' => AccessRule::accessRule(Yii::$app->controller->id, 'view') == false ? 'hide' : '']);
}, 'delete' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', [Yii::$app->controller->id . '/delete', 'id' => $model->id], ['title' => 'Delete', 'data-pjax' => '0', 'data-confirm' => 'Are you sure you want to delete this item1?', 'data-method' => 'POST', 'class' => AccessRule::accessRule(Yii::$app->controller->id, 'delete') == false ? 'hide' : '']);
}]]]]);
?>
                                <?php 
Pjax::end();
?>
      
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
예제 #9
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'ruleConfig' => ['class' => AccessRule::className()], 'only' => ['create', 'view', 'update', 'delete'], 'rules' => [['actions' => ['login', 'error'], 'allow' => true], ['actions' => ['logout', 'index'], 'allow' => true, 'roles' => ['@']], ['actions' => ['create', 'update', 'delete'], 'allow' => true, 'roles' => [User::LEVEL_ADMIN]], ['actions' => ['view'], 'allow' => true, 'roles' => [User::LEVEL_ADMIN, User::LEVEL_INTERNAL_PEMERINTAH, User::LEVEL_INTERNAL_NON_PEMERINTAH, User::LEVEL_EKSTERNAL_PEMERINTAH]]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['logout' => ['post'], 'delete' => ['POST']]]];
 }
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'ruleConfig' => ['class' => AccessRule::className()], 'only' => ['logout', 'signup', 'statistics'], 'rules' => [['actions' => ['signup'], 'allow' => true, 'roles' => ['?']], ['actions' => ['logout'], 'allow' => true, 'roles' => ['@']], ['actions' => ['statistics'], 'allow' => true, 'roles' => [User::ROLE_ADMIN, User::ROLE_SUPER]]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['logout' => ['post']]]];
 }
 public function behaviors()
 {
     return ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['POST', 'GET']]], 'access' => ['class' => AccessControl::className(), 'ruleConfig' => ['class' => AccessRule::className()], 'only' => ['index', 'create', 'update', 'delete', 'reset', 'changepassword'], 'rules' => [['actions' => ['index', 'create', 'update', 'delete', 'reset', 'changepassword'], 'allow' => true, 'roles' => [\common\models\User::ROLE_ADMIN]]]]];
 }
예제 #12
0
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'ruleConfig' => ['class' => AccessRule::className()], 'only' => ['create', 'view', 'update', 'delete', 'export', 'ubah', 'deaktivasi'], 'rules' => [['actions' => ['create', 'view', 'update', 'delete', 'export'], 'allow' => true, 'roles' => [User::LEVEL_ADMIN]], ['actions' => ['ubah', 'deaktivasi'], 'allow' => true, 'roles' => ['@']]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['POST']]]];
 }