cfmgrv4 init...10

This commit is contained in:
최준흠 2025-03-12 14:30:46 +09:00
parent ce32ee7bad
commit 364567c138
22 changed files with 41 additions and 29 deletions

View File

@ -18,7 +18,6 @@ use App\Services\MyLogService;
abstract class CommonController extends BaseController abstract class CommonController extends BaseController
{ {
private $_viewDatas = []; private $_viewDatas = [];
abstract protected function getService(): mixed; abstract protected function getService(): mixed;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{ {
@ -74,6 +73,7 @@ abstract class CommonController extends BaseController
switch ($field) { switch ($field) {
default: default:
$options[$field] = lang($this->getService()->getClassPath() . '.' . strtoupper($field)); $options[$field] = lang($this->getService()->getClassPath() . '.' . strtoupper($field));
// dd($options);
break; break;
} }
return $options; return $options;
@ -86,6 +86,7 @@ abstract class CommonController extends BaseController
} }
$options = $this->getFormFieldOption($field, $options); $options = $this->getFormFieldOption($field, $options);
} }
// dd($options);
return $options; return $options;
} }
// 생성 // 생성

View File

@ -38,7 +38,7 @@ class AuthFilter implements FilterInterface
// dd($auth->popPreviousUrl()); // dd($auth->popPreviousUrl());
return redirect()->back()->with( return redirect()->back()->with(
'error', 'error',
"회원[{$auth->getAuthInfo('name')}]님은 접속에 필요한 권한이 없습니다. " "회원[{$auth->getNameByAuthInfo()}]님은 접속에 필요한 권한이 없습니다. "
); );
} }
} }

View File

@ -2,10 +2,9 @@
namespace App\Helpers\Cloudflare; namespace App\Helpers\Cloudflare;
use App\Helpers\MVCHelper;
use App\Models\Cloudflare\AccountModel; use App\Models\Cloudflare\AccountModel;
class AccountHelper extends MVCHelper class AccountHelper extends CloudflareHelper
{ {
public $old_parent = ""; public $old_parent = "";

View File

@ -2,10 +2,10 @@
namespace App\Helpers\Cloudflare; namespace App\Helpers\Cloudflare;
use App\Helpers\MVCHelper; use App\Helpers\CommonHelper;
use App\Models\Cloudflare\AuditLogModel; use App\Models\Cloudflare\AuditLogModel;
class AuditLogHelper extends MVCHelper class AuditLogHelper extends CloudflareHelper
{ {
public $old_parent = ""; public $old_parent = "";
public function __construct() public function __construct()

View File

@ -5,7 +5,7 @@ namespace App\Helpers\Cloudflare;
use App\Helpers\MVCHelper; use App\Helpers\MVCHelper;
use App\Models\Cloudflare\AuthModel; use App\Models\Cloudflare\AuthModel;
class AuthHelper extends MVCHelper class AuthHelper extends CloudflareHelper
{ {
public function __construct() public function __construct()
{ {

View File

@ -0,0 +1,14 @@
<?php
namespace App\Helpers\Cloudflare;
use App\Helpers\CommonHelper;
class CloudflareHelper extends CommonHelper
{
public $old_parent = "";
public function __construct()
{
parent::__construct();
}
}

View File

@ -2,10 +2,9 @@
namespace App\Helpers\Cloudflare; namespace App\Helpers\Cloudflare;
use App\Helpers\MVCHelper;
use App\Models\Cloudflare\FirewallModel; use App\Models\Cloudflare\FirewallModel;
class FirewallHelper extends MVCHelper class FirewallHelper extends CloudflareHelper
{ {
public $old_parent = ""; public $old_parent = "";
public function __construct() public function __construct()

View File

@ -2,10 +2,9 @@
namespace App\Helpers\Cloudflare; namespace App\Helpers\Cloudflare;
use App\Helpers\MVCHelper;
use App\Models\Cloudflare\RecordModel; use App\Models\Cloudflare\RecordModel;
class RecordHelper extends MVCHelper class RecordHelper extends CloudflareHelper
{ {
public $old_parent = ""; public $old_parent = "";

View File

@ -2,10 +2,9 @@
namespace App\Helpers\Cloudflare; namespace App\Helpers\Cloudflare;
use App\Helpers\MVCHelper;
use App\Models\Cloudflare\ZoneModel; use App\Models\Cloudflare\ZoneModel;
class ZoneHelper extends MVCHelper class ZoneHelper extends CloudflareHelper
{ {
public $old_parent = ""; public $old_parent = "";
@ -112,7 +111,7 @@ class ZoneHelper extends MVCHelper
); );
$firewall_reload = ""; $firewall_reload = "";
$firewall_flag = ""; $firewall_flag = "";
if (in_array($viewDatas['myauth']->getAuthInfo('id'), explode(",", env("cloudflare.firewall.acl")))) { if (in_array($viewDatas['myauth']->getIDByAuthInfo('id'), explode(",", env("cloudflare.firewall.acl")))) {
$firewall_reload = anchor( $firewall_reload = anchor(
base_url() . $viewDatas['uri_path'] . 'firewall/reload/' . $viewDatas['entity']->getPK(), base_url() . $viewDatas['uri_path'] . 'firewall/reload/' . $viewDatas['entity']->getPK(),
ICONS["RELOAD"], ICONS["RELOAD"],

View File

@ -69,7 +69,7 @@ class AuthService extends CommonService
final public function isAccessRole(array $roles): bool final public function isAccessRole(array $roles): bool
{ {
$role = $this->getAuthInfo(key: 'role'); $role = $this->getRoleByAuthInfo();
if ($role === "") { if ($role === "") {
return false; return false;
} }

View File

@ -14,7 +14,7 @@ class AccountService extends CloudflareService
public function __construct() public function __construct()
{ {
parent::__construct("Account"); parent::__construct("Account", "Account");
} }
private function getParentEntity(): AuthEntity private function getParentEntity(): AuthEntity

View File

@ -15,7 +15,7 @@ class AuditLogService extends CloudflareService
public function __construct() public function __construct()
{ {
parent::__construct("AuditLog"); parent::__construct("AuditLog", "AuditLog");
} }
public function getModel(): AuditLogModel public function getModel(): AuditLogModel

View File

@ -11,7 +11,7 @@ class AuthService extends CloudflareService
public function __construct() public function __construct()
{ {
parent::__construct("Auth"); parent::__construct("Auth", "Auth");
} }
public function getModel(): AuthModel public function getModel(): AuthModel

View File

@ -13,7 +13,7 @@ abstract class CloudflareService extends CommonService
private array $_mySockets = []; private array $_mySockets = [];
private ?AuthEntity $_auth_entity = null; private ?AuthEntity $_auth_entity = null;
private ?AuthModel $_authModel = null; private ?AuthModel $_authModel = null;
protected function __construct(string $class_name, string $class_path = "") protected function __construct(string $class_name, string $class_path)
{ {
parent::__construct($class_name, "Cloudflare/" . $class_path); parent::__construct($class_name, "Cloudflare/" . $class_path);
} }

View File

@ -16,7 +16,7 @@ class FirewallService extends CloudflareService
public function __construct() public function __construct()
{ {
parent::__construct("Firewall"); parent::__construct("Firewall", "Firewall");
} }
private function getParentEntity(): ZoneEntity private function getParentEntity(): ZoneEntity

View File

@ -16,7 +16,7 @@ class RecordService extends CloudflareService
public function __construct() public function __construct()
{ {
parent::__construct("Record"); parent::__construct("Record", "Record");
} }
private function getParentEntity(): ZoneEntity private function getParentEntity(): ZoneEntity

View File

@ -21,7 +21,7 @@ class ZoneService extends CloudflareService
public function __construct() public function __construct()
{ {
parent::__construct("Zone"); parent::__construct("Zone", class_path: "Zone");
} }
private function getParentEntity(): AccountEntity private function getParentEntity(): AccountEntity

View File

@ -7,10 +7,11 @@ abstract class CommonService
private $_serviceDatas = []; private $_serviceDatas = [];
private $class_name = ""; private $class_name = "";
private $class_path = ""; private $class_path = "";
public function __construct(string $class_name, string $class_path = "") public function __construct(string $class_name, string $class_path)
{ {
$this->class_name = $class_name; $this->class_name = $class_name;
$this->class_path = $class_path ? $class_path : $this->class_name; $this->class_path = $class_path;
// dd($this->class_name, $this->class_path);
} }
abstract public function getModel(): mixed; abstract public function getModel(): mixed;

View File

@ -10,7 +10,7 @@ class MapurlService extends CommonService
private ?MapurlModel $_model = null; private ?MapurlModel $_model = null;
public function __construct() public function __construct()
{ {
parent::__construct("Mapurl"); parent::__construct("Mapurl", "Mapurl");
} }
public function getModel(): MapurlModel public function getModel(): MapurlModel
{ {

View File

@ -10,7 +10,7 @@ class UserSNSService extends CommonService
private ?UserSNSModel $_model = null; private ?UserSNSModel $_model = null;
public function __construct() public function __construct()
{ {
parent::__construct("UserSNS"); parent::__construct("UserSNS", "UserSNS");
} }
public function getModel(): UserSNSModel public function getModel(): UserSNSModel
{ {

View File

@ -10,7 +10,7 @@ class UserService extends CommonService
private ?UserModel $_model = null; private ?UserModel $_model = null;
public function __construct() public function __construct()
{ {
parent::__construct("User"); parent::__construct("User", "User");
} }
public function getModel(): UserModel public function getModel(): UserModel
{ {

View File

@ -14,7 +14,7 @@
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-outline-primary dropdown-toggle" data-bs-toggle="dropdown" <button type="button" class="btn btn-outline-primary dropdown-toggle" data-bs-toggle="dropdown"
aria-expanded="false"> aria-expanded="false">
<b><?= ICONS['LOGIN'] . $viewDatas['myauth']->getAuthInfo('name') ?></b> <b><?= ICONS['LOGIN'] . $viewDatas['myauth']->getNameByAuthInfo('name') ?></b>
</button> </button>
<ul class="dropdown-menu dropdown-menu-end"> <ul class="dropdown-menu dropdown-menu-end">
<li><?= form_label( <li><?= form_label(
@ -22,7 +22,7 @@
"modify", "modify",
[ [
"class" => "dropdown-item", "class" => "dropdown-item",
"data-src" => "/user/modify/" . $viewDatas['myauth']->getAuthInfo('uid'), "data-src" => "/user/modify/" . $viewDatas['myauth']->getUIDByAuthInfo('uid'),
"data-bs-toggle" => "modal", "data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form" "data-bs-target" => "#index_action_form"
] ]