|
|
|
@@ -7,7 +7,9 @@ use App\Exceptions\AppCommonException; |
|
|
|
use App\Features\LoginUser; |
|
|
|
use App\Http\Controllers\Web\IParam; |
|
|
|
use App\Http\Controllers\Web\WebController; |
|
|
|
use App\Logic\User\ContractAdminUserManager; |
|
|
|
use App\Logic\User\LoginUserManager; |
|
|
|
use App\Logic\User\UserManager; |
|
|
|
use App\Repositories\LoginUserRepository; |
|
|
|
use Illuminate\Http\JsonResponse; |
|
|
|
use Illuminate\Http\Request; |
|
|
|
@@ -17,19 +19,20 @@ class CreateController extends WebController |
|
|
|
|
|
|
|
use LoginUser; |
|
|
|
|
|
|
|
private UserManager $manager; |
|
|
|
|
|
|
|
public function name(): string |
|
|
|
{ |
|
|
|
return "ログインユーザー一覧取得"; |
|
|
|
return "ログインユーザー新規登録"; |
|
|
|
} |
|
|
|
|
|
|
|
public function description(): string |
|
|
|
{ |
|
|
|
return "ログインユーザー一覧を取得する"; |
|
|
|
return "ログインユーザーを新規登録する"; |
|
|
|
} |
|
|
|
|
|
|
|
public function __construct( |
|
|
|
protected CreateParam $param, |
|
|
|
private LoginUserManager $manager |
|
|
|
) { |
|
|
|
parent::__construct(); |
|
|
|
$this->roleAllow(UserRole::CONTRACT_ADMIN); |
|
|
|
@@ -44,11 +47,20 @@ class CreateController extends WebController |
|
|
|
{ |
|
|
|
$param = $this->param; |
|
|
|
|
|
|
|
// マネージャー起動 |
|
|
|
if ($param->role === UserRole::CONTRACT_ADMIN) { |
|
|
|
if ($this->loginUser()->user()->role === UserRole::SUPER_ADMIN) { |
|
|
|
$this->manager = new ContractAdminUserManager(); |
|
|
|
} else { |
|
|
|
$this->unAuthorizedResponse(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
$this->manager = new LoginUserManager(); |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
$this->transaction->beginTransaction(); |
|
|
|
|
|
|
|
|
|
|
|
$currentContract = $this->loginUser()->getCurrentContract(); |
|
|
|
if (!$currentContract) { |
|
|
|
throw new AppCommonException("認証不正"); |
|
|
|
|