28 lines
629 B
PHP
28 lines
629 B
PHP
<?php
|
|
|
|
namespace App\Libraries\MyAuth;
|
|
|
|
use App\Entities\UserEntity;
|
|
use App\Libraries\CommonLibrary;
|
|
|
|
// 참고:https://github.com/SyntaxPhoenix/iloclient
|
|
abstract class MyAuth extends CommonLibrary
|
|
{
|
|
private $_session = null;
|
|
protected function __construct()
|
|
{
|
|
$this->_session = \Config\Services::session();
|
|
}
|
|
abstract public function getAuthButton();
|
|
|
|
final public function setLogin(UserEntity $entity): void
|
|
{
|
|
$this->_session->set(SESSION_NAMES['ISLOGIN'], true);
|
|
$this->_session->set(SESSION_NAMES['AUTH'], [
|
|
'uid' => $entity->getPK(),
|
|
'name' => $entity->getTitle(),
|
|
'role' => $entity->role
|
|
]);
|
|
}
|
|
}
|