From e901dfdeb7c69124c86063bbc462a41bec6fc403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Wed, 19 Jul 2023 17:06:48 +0900 Subject: [PATCH] servermgrv2 init... --- app/Entities/CommonEntity.php | 8 +++----- app/Entities/HPILOEntity.php | 16 ---------------- app/Entities/UserEntity.php | 12 ------------ app/Entities/UserSNSEntity.php | 16 ---------------- app/Libraries/Adapter/Auth/GoogleAdapter.php | 2 +- 5 files changed, 4 insertions(+), 50 deletions(-) diff --git a/app/Entities/CommonEntity.php b/app/Entities/CommonEntity.php index fea63d3..194d7e8 100644 --- a/app/Entities/CommonEntity.php +++ b/app/Entities/CommonEntity.php @@ -4,10 +4,8 @@ namespace App\Entities; use CodeIgniter\Entity\Entity; -class CommonEntity extends Entity +abstract class CommonEntity extends Entity { - public function getTitle() - { - return "CommonEntity"; - } + abstract public function getPrimaryKey(); + abstract public function getTitle(); } diff --git a/app/Entities/HPILOEntity.php b/app/Entities/HPILOEntity.php index 74bff39..34dd9cc 100644 --- a/app/Entities/HPILOEntity.php +++ b/app/Entities/HPILOEntity.php @@ -14,22 +14,6 @@ class HPILOEntity extends CommonEntity { return $this->attributes['uid']; } - public function getID() - { - return $this->attributes['id']; - } - public function getPassword() - { - return $this->attributes['passwd']; - } - public function getIP() - { - return $this->attributes['ip']; - } - public function getPort() - { - return $this->attributes['port']; - } public function getTitle() { return "{$this->attributes['customer']} {$this->attributes['model']}"; diff --git a/app/Entities/UserEntity.php b/app/Entities/UserEntity.php index c477912..6b0de1b 100644 --- a/app/Entities/UserEntity.php +++ b/app/Entities/UserEntity.php @@ -18,20 +18,8 @@ class UserEntity extends CommonEntity { return $this->attributes['name']; } - public function getEmail() - { - return $this->attributes['email']; - } - public function getRole() - { - return $this->attributes['role']; - } public function getPassword() { return $this->attributes['passwd']; } - public function getEncryptedPassword(string $password) - { - return password_hash($password, PASSWORD_DEFAULT); - } } diff --git a/app/Entities/UserSNSEntity.php b/app/Entities/UserSNSEntity.php index 6c67bd6..1834b41 100644 --- a/app/Entities/UserSNSEntity.php +++ b/app/Entities/UserSNSEntity.php @@ -14,24 +14,8 @@ class UserSNSEntity extends CommonEntity { return $this->attributes['uid']; } - public function getUserUID() - { - return $this->attributes['user_uid']; - } - public function getSite() - { - return $this->attributes['site']; - } public function getTitle() { return $this->attributes['name']; } - public function getEmail() - { - return $this->attributes['email']; - } - public function getStatus() - { - return $this->attributes['status']; - } } diff --git a/app/Libraries/Adapter/Auth/GoogleAdapter.php b/app/Libraries/Adapter/Auth/GoogleAdapter.php index 818753c..a45197c 100644 --- a/app/Libraries/Adapter/Auth/GoogleAdapter.php +++ b/app/Libraries/Adapter/Auth/GoogleAdapter.php @@ -105,7 +105,7 @@ class GoogleAdapter extends Adapter if (is_null($snsEntity)) { $snsEntity = $this->getUserSNSModel()->create($this->getSiteName(), $result); } - if (!$snsEntity->getUserUID()) { + if (!$snsEntity->user_id) { throw new \Exception($this->getSiteName() . "의{$result['email']}:{$result['name']}님은 아직 사용자 지정이 되지 않았습니다."); } if ($snsEntity->getStatus() !== DEFAULTS['STATUS']) {