37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin;
|
|
|
|
use App\Controllers\BaseController;
|
|
|
|
abstract class AdminController extends BaseController
|
|
{
|
|
private $_datas = [];
|
|
final public function __get($name)
|
|
{
|
|
// echo "Getting '$name'\n";
|
|
if (array_key_exists($name, $this->_datas)) {
|
|
return $this->_datas[$name];
|
|
}
|
|
return null;
|
|
}
|
|
|
|
final public function __set($name, $value)
|
|
{
|
|
// echo "Setting '$name' to '$value'\n";
|
|
$this->_datas[$name] = $value;
|
|
}
|
|
protected function __construct()
|
|
{
|
|
//사용자 기본 Role 지정
|
|
$this->_datas[SESSION['NAMES']['ISLOGIN']] = false;
|
|
$this->_datas['currentRoles'] = [DEFAULTS["ROLE"]];
|
|
if ($this->_session->get(SESSION['NAMES']['ISLOGIN'])) {
|
|
$this->_datas[SESSION['NAMES']['ISLOGIN']] = true;
|
|
$this->_datas['auth'] = $this->_session->get(SESSION['NAMES']['AUTH']);
|
|
$currentRoles = explode(DEFAULTS['DELIMITER_ROLE'], $this->_datas['auth'][AUTH['FIELDS']['ROLE']]);
|
|
$this->_datas['currentRoles'] = is_array($currentRoles) ? $currentRoles : [DEFAULTS["ROLE"]];
|
|
}
|
|
}
|
|
}
|