add access control to backend
This commit is contained in:
parent
e34b150d74
commit
1ee0a6bbe9
@ -23,6 +23,18 @@ class AccountController extends Controller
|
|||||||
'delete' => ['post'],
|
'delete' => ['post'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'access' => [
|
||||||
|
'class' => \yii\filters\AccessControl::className(),
|
||||||
|
'only' => [ 'index','view','create','update'],
|
||||||
|
'rules' => [
|
||||||
|
// allow authenticated users
|
||||||
|
[
|
||||||
|
'allow' => true,
|
||||||
|
'roles' => ['@'],
|
||||||
|
],
|
||||||
|
// everything else is denied
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,18 @@ class DiscountController extends Controller
|
|||||||
'delete' => ['post'],
|
'delete' => ['post'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'access' => [
|
||||||
|
'class' => \yii\filters\AccessControl::className(),
|
||||||
|
'only' => [ 'index','view','create','update'],
|
||||||
|
'rules' => [
|
||||||
|
// allow authenticated users
|
||||||
|
[
|
||||||
|
'allow' => true,
|
||||||
|
'roles' => ['@'],
|
||||||
|
],
|
||||||
|
// everything else is denied
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,18 @@ class ProcurementController extends Controller
|
|||||||
'delete' => ['post'],
|
'delete' => ['post'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'access' => [
|
||||||
|
'class' => \yii\filters\AccessControl::className(),
|
||||||
|
'only' => [ 'index','view','create','update'],
|
||||||
|
'rules' => [
|
||||||
|
// allow authenticated users
|
||||||
|
[
|
||||||
|
'allow' => true,
|
||||||
|
'roles' => ['@'],
|
||||||
|
],
|
||||||
|
// everything else is denied
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,19 @@ class ProductCategoryController extends Controller
|
|||||||
'delete' => ['post'],
|
'delete' => ['post'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'access' => [
|
||||||
|
'class' => \yii\filters\AccessControl::className(),
|
||||||
|
'only' => [ 'index','view','create','update'],
|
||||||
|
'rules' => [
|
||||||
|
// allow authenticated users
|
||||||
|
[
|
||||||
|
'allow' => true,
|
||||||
|
'roles' => ['@'],
|
||||||
|
],
|
||||||
|
// everything else is denied
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,9 +25,22 @@ class ProductController extends Controller
|
|||||||
'delete' => ['post'],
|
'delete' => ['post'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'access' => [
|
||||||
|
'class' => \yii\filters\AccessControl::className(),
|
||||||
|
'only' => [ 'index','view','create','update'],
|
||||||
|
'rules' => [
|
||||||
|
// allow authenticated users
|
||||||
|
[
|
||||||
|
'allow' => true,
|
||||||
|
'roles' => ['@'],
|
||||||
|
],
|
||||||
|
// everything else is denied
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists all Product models.
|
* Lists all Product models.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
|||||||
@ -24,6 +24,18 @@ class TicketTypeController extends Controller
|
|||||||
'delete' => ['post'],
|
'delete' => ['post'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'access' => [
|
||||||
|
'class' => \yii\filters\AccessControl::className(),
|
||||||
|
'only' => [ 'index','view','create','update'],
|
||||||
|
'rules' => [
|
||||||
|
// allow authenticated users
|
||||||
|
[
|
||||||
|
'allow' => true,
|
||||||
|
'roles' => ['@'],
|
||||||
|
],
|
||||||
|
// everything else is denied
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,18 @@ class UserController extends Controller
|
|||||||
'delete' => ['post'],
|
'delete' => ['post'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'access' => [
|
||||||
|
'class' => \yii\filters\AccessControl::className(),
|
||||||
|
'only' => [ 'index', 'create','update','view'],
|
||||||
|
'rules' => [
|
||||||
|
// allow authenticated users
|
||||||
|
[
|
||||||
|
'allow' => true,
|
||||||
|
'roles' => ['@'],
|
||||||
|
],
|
||||||
|
// everything else is denied
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,18 @@ class WarehouseController extends Controller
|
|||||||
'delete' => ['post'],
|
'delete' => ['post'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'access' => [
|
||||||
|
'class' => \yii\filters\AccessControl::className(),
|
||||||
|
'only' => [ 'create','update','view','index'],
|
||||||
|
'rules' => [
|
||||||
|
// allow authenticated users
|
||||||
|
[
|
||||||
|
'allow' => true,
|
||||||
|
'roles' => ['@'],
|
||||||
|
],
|
||||||
|
// everything else is denied
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,9 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
'email:email',
|
'email:email',
|
||||||
'created_at:datetime',
|
'created_at:datetime',
|
||||||
|
|
||||||
['class' => 'yii\grid\ActionColumn'],
|
['class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{view} {update}'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
]); ?>
|
]); ?>
|
||||||
|
|
||||||
|
|||||||
@ -16,13 +16,6 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
<?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
<?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||||
<?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [
|
|
||||||
'class' => 'btn btn-danger',
|
|
||||||
'data' => [
|
|
||||||
'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
|
|
||||||
'method' => 'post',
|
|
||||||
],
|
|
||||||
]) ?>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<?= DetailView::widget([
|
<?= DetailView::widget([
|
||||||
|
|||||||
@ -20,7 +20,7 @@ return [
|
|||||||
'Accounts' => 'Kasszák',
|
'Accounts' => 'Kasszák',
|
||||||
'Account' => 'Kassza',
|
'Account' => 'Kassza',
|
||||||
'Active' => 'Aktív',
|
'Active' => 'Aktív',
|
||||||
'Create' => 'Inaktív',
|
'Create' => 'Mentés',
|
||||||
'Create Account' => 'Új kassza',
|
'Create Account' => 'Új kassza',
|
||||||
'Created At' => 'Létrehozás ideje',
|
'Created At' => 'Létrehozás ideje',
|
||||||
'Id Account' => 'Azonosító',
|
'Id Account' => 'Azonosító',
|
||||||
|
|||||||
@ -209,7 +209,9 @@ class User extends ActiveRecord implements IdentityInterface
|
|||||||
|
|
||||||
public function attributeLabels(){
|
public function attributeLabels(){
|
||||||
return [
|
return [
|
||||||
|
'username' => Yii::t('backend/user', 'Username'),
|
||||||
|
'email' => Yii::t('backend/user', 'E-Mail'),
|
||||||
|
'created_at' => Yii::t('backend/user', 'Created at'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.4.0",
|
"php": ">=5.4.0",
|
||||||
"yiisoft/yii2": ">=2.0.6",
|
"yiisoft/yii2": "2.0.6",
|
||||||
"yiisoft/yii2-bootstrap": "*",
|
"yiisoft/yii2-bootstrap": "*",
|
||||||
"yiisoft/yii2-swiftmailer": "*",
|
"yiisoft/yii2-swiftmailer": "*",
|
||||||
"kartik-v/yii2-widgets": "^3.4",
|
"kartik-v/yii2-widgets": "^3.4",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user