Added permissions to Order

This commit is contained in:
Frank Schubert
2021-08-06 16:35:38 +02:00
parent 2a4d5ac7d2
commit 4d51eb23f3
7 changed files with 231 additions and 21 deletions

View File

@@ -9,16 +9,22 @@ class ProductController extends mfBaseController {
$this->me = $me;
$this->layout()->set("me",$me);
if(!$me->isAdmin()) {
if(!$me->is(["Admin","netowner","pipeplanner"])) {
$this->redirect("Dashboard");
}
}
protected function indexAction() {
if(!$me->is(["Admin"])) {
$this->redirect("Dashboard");
}
$this->layout()->set("products", ProductModel::getAll());
}
protected function addAction() {
if(!$me->is(["Admin"])) {
$this->redirect("Dashboard");
}
$this->layout()->setTemplate("Product/Form");
$this->layout()->set("productgroups", ProductgroupModel::getAll());
$this->layout()->set("producttechs", ProducttechModel::getAll());
@@ -28,6 +34,9 @@ class ProductController extends mfBaseController {
}
protected function editAction() {
if(!$me->is(["Admin"])) {
$this->redirect("Dashboard");
}
$product_id = $this->request->id;
$product = new Product($product_id);
if(!$product->id) {
@@ -43,6 +52,10 @@ class ProductController extends mfBaseController {
}
protected function saveAction() {
if(!$me->is(["Admin"])) {
$this->redirect("Dashboard");
}
$r = $this->request;
//var_dump($r);exit;
$id = $r->id;
@@ -166,6 +179,10 @@ class ProductController extends mfBaseController {
}
protected function deleteAction() {
if(!$me->is(["Admin"])) {
$this->redirect("Dashboard");
}
$id = $this->request->id;
$product = new Product($id);
@@ -180,6 +197,9 @@ class ProductController extends mfBaseController {
}
protected function apiAction() {
if(!$me->is(["Admin","netowner","pipeplanner"])) {
$this->redirect("Dashboard");
}
$do = $this->request->do;
$data = [];