public function safeDown()
 {
     Permission::deleteAll(['name' => ['viewUsers', 'createUsers', 'editUsers', 'deleteUsers', 'changeUserPassword', 'assignRolesToUsers', 'viewVisitLog', 'viewUserRoles', 'viewRegistrationIp', 'viewUserEmail', 'editUserEmail', 'bindUserToIp']]);
     Permission::deleteAll(['name' => ['changeOwnPassword']]);
     Role::deleteIfExists(['name' => 'Admin']);
     AuthItemGroup::deleteAll(['code' => ['userManagement', 'userCommonPermissions']]);
 }
 public function search($params)
 {
     $query = AuthItemGroup::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => Yii::$app->request->cookies->getValue('_grid_page_size', 20)], 'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]]]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     if ($this->created_at) {
         $tmp = explode(' - ', $this->created_at);
         if (isset($tmp[0], $tmp[1])) {
             $query->andFilterWhere(['between', Yii::$app->getModule('user-management')->auth_item_group_table . '.created_at', strtotime($tmp[0]), strtotime($tmp[1])]);
         }
     }
     $query->andFilterWhere(['like', Yii::$app->getModule('user-management')->auth_item_group_table . '.code', $this->code])->andFilterWhere(['like', Yii::$app->getModule('user-management')->auth_item_group_table . '.name', $this->name]);
     return $dataProvider;
 }
Exemple #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getGroup()
 {
     return $this->hasOne(AuthItemGroup::className(), ['code' => 'group_code']);
 }
Exemple #4
0
				</p>
			</div>

			<div class="col-sm-6 text-right">
				<?php 
echo GridPageSize::widget(['pjaxId' => 'permission-grid-pjax']);
?>
			</div>
		</div>

		<?php 
Pjax::begin(['id' => 'permission-grid-pjax']);
?>

		<?php 
echo GridView::widget(['id' => 'permission-grid', 'dataProvider' => $dataProvider, 'pager' => ['options' => ['class' => 'pagination pagination-sm'], 'hideOnSinglePage' => true, 'lastPageLabel' => '>>', 'firstPageLabel' => '<<'], 'filterModel' => $searchModel, 'layout' => '{items}<div class="row"><div class="col-sm-8">{pager}</div><div class="col-sm-4 text-right">{summary}' . GridBulkActions::widget(['gridId' => 'permission-grid', 'actions' => [Url::to(['bulk-delete']) => GridBulkActions::t('app', 'Delete')]]) . '</div></div>', 'columns' => [['class' => 'yii\\grid\\SerialColumn', 'options' => ['style' => 'width:10px']], ['attribute' => 'description', 'value' => function ($model) {
    if ($model->name == Yii::$app->getModule('user-management')->commonPermissionName) {
        return Html::a($model->description, ['view', 'id' => $model->name], ['data-pjax' => 0, 'class' => 'label label-primary']);
    } else {
        return Html::a($model->description, ['view', 'id' => $model->name], ['data-pjax' => 0]);
    }
}, 'format' => 'raw'], 'name', ['attribute' => 'group_code', 'filter' => ArrayHelper::map(AuthItemGroup::find()->asArray()->all(), 'code', 'name'), 'value' => function (Permission $model) {
    return $model->group_code ? $model->group->name : '';
}], ['class' => 'yii\\grid\\CheckboxColumn', 'options' => ['style' => 'width:10px']], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['style' => 'width:70px; text-align:center;']]]]);
?>

		<?php 
Pjax::end();
?>
	</div>
</div>
 public function safeDown()
 {
     AuthItemGroup::deleteAll(['code' => 'settings']);
     Permission::deleteAll(['name' => ['fullAccessToSettings', 'accessToSeoSettings']]);
     AuthHelper::invalidatePermissions();
 }
Exemple #6
0
?>

<?php 
$form = ActiveForm::begin(['id' => 'role-form', 'layout' => 'horizontal', 'validateOnBlur' => false]);
?>

	<?php 
echo $form->field($model, 'description')->textInput(['maxlength' => 255, 'autofocus' => $model->isNewRecord ? true : false]);
?>

	<?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 64]);
?>

	<?php 
echo $form->field($model, 'group_code')->dropDownList(ArrayHelper::map(AuthItemGroup::find()->asArray()->all(), 'code', 'name'), ['prompt' => '']);
?>

	<div class="form-group">
		<div class="col-sm-offset-3 col-sm-9">
			<?php 
if ($model->isNewRecord) {
    ?>
				<?php 
    echo Html::submitButton('<span class="glyphicon glyphicon-plus-sign"></span> ' . UserManagementModule::t('back', 'Create'), ['class' => 'btn btn-success']);
    ?>
			<?php 
} else {
    ?>
				<?php 
    echo Html::submitButton('<span class="glyphicon glyphicon-ok"></span> ' . UserManagementModule::t('back', 'Save'), ['class' => 'btn btn-primary']);