Fixed User::MyNetwork (NetworkAddress)
This commit is contained in:
41
application/Admin/AdminController.php
Normal file
41
application/Admin/AdminController.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
class AdminController extends mfBaseController {
|
||||
|
||||
protected function init() {
|
||||
$this->needlogin=true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me",$me);
|
||||
|
||||
if(!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction() {
|
||||
$this->layout()->setTemplate("Admin/Index");
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected function createNetworkAddressForNetowner() {
|
||||
$i = 0;
|
||||
foreach(NetworkModel::getAll() as $network) {
|
||||
$netaddress = NetworkAddressModel::getFirst(["network_id" => $network->id, "address_id" => $network->owner_id, "addresstype" => "netowner"]);
|
||||
if(!$netaddress) {
|
||||
$netaddress = NetworkAddressModel::create([
|
||||
'network_id' => $network->id,
|
||||
'address_id' => $network->owner_id,
|
||||
'type' => "netowner"
|
||||
]);
|
||||
$netaddress->save();
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$this->layout()->setFlash("$i NetworkAddress Objekte angelegt.", "success");
|
||||
$this->redirect("Admin");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user