cfmgrv4 init...2
This commit is contained in:
parent
98dce63599
commit
bceadee030
@ -332,15 +332,11 @@ abstract class MVController extends CommonController
|
||||
//Sorting 처리
|
||||
$this->order_field = $this->request->getVar('order_field') ?: DEFAULTS['EMPTY'];
|
||||
$this->order_value = $this->request->getVar('order_value') ?: DEFAULTS['EMPTY'];
|
||||
$this->getModel()->setList_OrderBy(
|
||||
$this->order_field !== DEFAULTS['EMPTY'] &&
|
||||
$this->order_value !== DEFAULTS['EMPTY'] ? "{$this->order_field} {$this->order_value}" : ""
|
||||
);
|
||||
if ($this->order_field !== DEFAULTS['EMPTY'] && $this->order_value !== DEFAULTS['EMPTY']) {
|
||||
$this->getModel()->setList_OrderBy("{$this->order_field} {$this->order_value}");
|
||||
}
|
||||
if ($this->page) {
|
||||
$this->getModel()->limit(
|
||||
$this->per_page,
|
||||
$this->page * $this->per_page - $this->per_page
|
||||
);
|
||||
$this->getModel()->limit($this->per_page, $this->page * $this->per_page - $this->per_page);
|
||||
}
|
||||
$entitys = $this->getModel()->select($this->getModel()->getTable() . '.*')->findAll();
|
||||
// log_message("debug", $this->getModel()->getLastQuery());
|
||||
@ -359,7 +355,7 @@ abstract class MVController extends CommonController
|
||||
//모델 처리
|
||||
$this->entitys = $this->list_entitys_process();
|
||||
// 현재 URL을 스택에 저장
|
||||
$this->myauth->pushCurrentUrl(current_url() . $this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : "");
|
||||
$this->myauth->pushCurrentUrl($this->request->getUri()->getPath());
|
||||
return view(
|
||||
$this->view_path . "index",
|
||||
['viewDatas' => $this->getViewDatas()]
|
||||
|
||||
@ -30,14 +30,12 @@ class AuthFilter implements FilterInterface
|
||||
// log_message("debug", var_export($arguments, true));
|
||||
// 로그인 않했으면
|
||||
if (!$auth->isLoggedIn()) {
|
||||
$currentURL = current_url();
|
||||
$queryString = $request->getUri()->getQuery();
|
||||
$auth->pushCurrentUrl($queryString ? "{$currentURL}?{$queryString}" : $currentURL);
|
||||
$auth->pushCurrentUrl($request->getUri()->getPath());
|
||||
return redirect()->to(URLS['LOGIN'])->with('error', '로그인을하셔야합니다.');
|
||||
}
|
||||
//User Role 비교 // 회원 ROLES이 필요ROLE($arguments[0]) 목록에 존재하지 않으면(ACL)
|
||||
if (!$auth->isAccessRole($arguments[0])) {
|
||||
$auth->popPreviousUrl();
|
||||
// dd($auth->popPreviousUrl());
|
||||
return redirect()->back()->with(
|
||||
'error',
|
||||
"회원[{$auth->getAuthInfo('name')}]님은 접속에 필요한 권한{$arguments[0]}이 없습니다. "
|
||||
|
||||
@ -4,9 +4,7 @@ namespace App\Helpers;
|
||||
|
||||
abstract class CommonHelper
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
}
|
||||
protected function __construct() {}
|
||||
final public function getRandomString($length = 10, $characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
|
||||
{
|
||||
return substr(str_shuffle($characters), 0, $length);
|
||||
@ -208,9 +206,11 @@ abstract class CommonHelper
|
||||
if (isset($viewDatas['order_field']) && $viewDatas['order_field'] == $field) {
|
||||
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS["UP"] : ICONS["DOWN"];
|
||||
}
|
||||
$viewDatas['uri']->addQuery('order_field', $field);
|
||||
$viewDatas['uri']->addQuery('order_value', $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC");
|
||||
$label = anchor(current_url() . ($viewDatas['uri']->getQuery() ? "?" . $viewDatas['uri']->getQuery() : ""), $label);
|
||||
$query = $viewDatas['uri']->getQuery(['except' => ['order_field', 'order_value']]);
|
||||
$query .= empty($query) ? "?" : "&";
|
||||
$query .= "order_field={$field}&order_value=";
|
||||
$query .= isset($viewDatas['order_value']) && $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
|
||||
$label = anchor(current_url() . $query, $label);
|
||||
break;
|
||||
}
|
||||
return $label;
|
||||
|
||||
@ -4,6 +4,7 @@ namespace App\Libraries\MyAuth;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
use App\Libraries\CommonLibrary;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\Session\Session;
|
||||
// 참고:https://github.com/SyntaxPhoenix/iloclient
|
||||
class MyAuth extends CommonLibrary
|
||||
@ -43,16 +44,15 @@ class MyAuth extends CommonLibrary
|
||||
|
||||
final public function pushCurrentUrl(string $url): void
|
||||
{
|
||||
$urlStack = $this->getSession()->get('url_stack') ?? [];
|
||||
$urlStack[] = $url;
|
||||
$this->getSession()->set('url_stack', $urlStack);
|
||||
$this->getSession()->set('url_stack', $url);
|
||||
}
|
||||
|
||||
final public function popPreviousUrl()
|
||||
final public function popPreviousUrl(): string
|
||||
{
|
||||
$urlStack = $this->getSession()->get('url_stack') ?? [];
|
||||
if (!empty($urlStack)) {
|
||||
return array_pop($urlStack);
|
||||
$url = $this->getSession()->get('url_stack') ?? "";
|
||||
if (!empty($url)) {
|
||||
$this->pushCurrentUrl("");
|
||||
return $url;
|
||||
}
|
||||
return '/'; // 기본 URL
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user