daemon-idc init
This commit is contained in:
parent
982b78ec76
commit
4ca8f06e86
@ -7,20 +7,20 @@ use CodeIgniter\Router\RouteCollection;
|
||||
*/
|
||||
// $routes->get('/', 'Home::index');
|
||||
|
||||
|
||||
//choi.jh
|
||||
//추가 Custom RULE 만들때 : ex)UUID형식
|
||||
$routes->addPlaceholder('uuid', '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}');
|
||||
//authFilter는 추가적인 작업이 필요
|
||||
//1. app/Filters/AuthFilter.php
|
||||
//2. Config/Filters.php -> $aliases = ['authFilter' => AuthFilter::class]
|
||||
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
||||
});
|
||||
|
||||
$routes->group('', ['namespace' => 'App\Controllers\Front'], function ($routes) {
|
||||
$routes->get('/', 'WelcomeController::index');
|
||||
});
|
||||
|
||||
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
||||
});
|
||||
|
||||
$routes->group('auth', ['namespace' => 'App\Controllers\Auth'], function ($routes) {
|
||||
$routes->get('login', 'LocalController::login_form');
|
||||
$routes->post('login', 'LocalController::login');
|
||||
|
||||
@ -32,6 +32,10 @@ class UserEntity extends CommonEntity
|
||||
{
|
||||
return $this->role;
|
||||
}
|
||||
public function getRoles(): array
|
||||
{
|
||||
return explode(DEFAULTS['DELIMITER_COMMA'], $this->getRole());
|
||||
}
|
||||
public function getEmail(): string
|
||||
{
|
||||
return $this->email;
|
||||
|
||||
@ -95,7 +95,7 @@ class BoardForm extends CommonForm
|
||||
case 'worker_uid':
|
||||
foreach ($this->getFormOption_process(service('userservice'), $field, $formDatas) as $tempEntity) {
|
||||
$tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle();
|
||||
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_COMMA'], $tempEntity->getRole())];
|
||||
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => $tempEntity->getRole()];
|
||||
}
|
||||
$options['options'] = $tempOptions;
|
||||
break;
|
||||
|
||||
@ -38,26 +38,30 @@ class AuthContext
|
||||
// Public Accessors (AuthService에서 이동)
|
||||
// ----------------------------------------------------
|
||||
|
||||
public function getUID(): int|null
|
||||
public function getUID(): int
|
||||
{
|
||||
return $this->getAuthInfo('uid');
|
||||
}
|
||||
|
||||
public function getID(): string|null
|
||||
public function getID(): string
|
||||
{
|
||||
return $this->getAuthInfo('id');
|
||||
}
|
||||
|
||||
public function getName(): string|null
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->getAuthInfo('name');
|
||||
}
|
||||
|
||||
public function getRole(): array|null
|
||||
public function getRole(): string
|
||||
{
|
||||
return $this->getAuthInfo('role');
|
||||
}
|
||||
|
||||
public function getRoles(): array
|
||||
{
|
||||
return explode(DEFAULTS['DELIMITER_COMMA'], $this->getRole());
|
||||
}
|
||||
public function isLoggedIn(): bool
|
||||
{
|
||||
return $this->session->has(self::SESSION_IS_LOGIN);
|
||||
@ -65,7 +69,7 @@ class AuthContext
|
||||
|
||||
public function isAccessRole(array $roles): bool
|
||||
{
|
||||
$userRoles = $this->getRole();
|
||||
$userRoles = $this->getRoles();
|
||||
if (empty($userRoles) || !is_array($userRoles)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user